Announcement

Collapse
No announcement yet.

Is there a way to strip a character?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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
    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>

    Comment


      #3
      Re: Is there a way to strip a character?

      That works perfect, thanks so much!

      Comment

      Working...
      X