24/7 Support - 800.608.6482

Miva Merchant Community Forums

  1. #1
    Join Date
    Apr 2012
    Posts
    132

    Default Is there a way to strip a character?

    Hi,

    In our product page I am trying to find a shortcut to help display some product images.

    The product comes in two sizes and the image we are using for both on the site is the same.

    Here's an example:

    Product Code: FBP_1001
    Description: Standard Size
    Front Image: FBP_1001_front.jpg
    Back Image: FBP_1001_back.gif

    For the jumbo size the images are the same but the product code is FBP_1001_J.

    Is there a way to use the code below for both products and if there is an "_J" in the Product Code have that stripped off? I have a work around but wanted to see if one or two lines of code would remedy this for me. This works fine for the standard size, just not for the jumbo size with "_J" in the Product Code.
    <img src="/images/products/&mvt:crumb:code;/&mvt:product:code;_front.jpg" alt=""><br>
    <img src="/images/products/&mvt:crumb:code;/&mvt:product:code;_back.gif" alt=""><br>


    Also, I am already using the "Thumbnail Image" & "Full-sized Image" fields for category screens images.

    Thanks in advance,
    Mike

  2. #2
    Join Date
    Jul 2008
    Location
    NE Ohio - Go Cavs!
    Posts
    981

    Default Re: Is there a way to strip a character?

    This takes the first 8 characters of the product code and turns it into a global variable called "img_code" then calls the image based on that value versus the actual product code. Downside is if you have pertinent parts of the code grow longer than 8 characters.

    Code:
    <mvt:item name="toolkit" param="newsubstring|img_code|l.all_settings:product:code,1,8" />
    <img src="/images/products/&mvt:crumb:code;/&mvt:global:img_code;_front.jpg" alt=""><br>
    <img src="/images/products/&mvt:crumb:code;/&mvt:global:img_code;_back.gif" alt=""><br>

  3. #3
    Join Date
    Apr 2012
    Posts
    132

    Default Re: Is there a way to strip a character?

    That works perfect, thanks so much!

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •