Product Image Source URL in JavaScript on OCST Page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mjstonez
    Mini Mivite

    • May 2006
    • 72

    #1

    Product Image Source URL in JavaScript on OCST Page

    Hello! We are trying to implement product image source urls in a JavaScript on the OCST page. This is for a third party shopping cart abandonment email campaign. Below is the script we are using, all aspects work great except the image issue. Anyone have a workaround or know of an existing module?


    <script type='text/javascript'>
    var _joinnew = _joinnew || [];
    _joinnew.push(['setAccount', '123456789']);
    _joinnew.push(['setDomain', '.mydomain.com']);
    (function() {
    var s = document.createElement('script'); s.type = 'text/javascript';
    s.async = true;
    s.src = 'https://s3.amazonaws.com/joinnew/js/v3/t.js';
    var x = document.getElementsByTagName('script')[0];
    x.parentNode.insertBefore(s, x);
    })();
    </script>
    <script type='text/javascript'>
    _joinnew.push(['setCartData', {
    'value': '&mvt:basket:formatted_total;',
    'totalItems': '&mvte:toolkit:basketcount;',
    'returnUrl': '&mvt:global:secure_sessionurl;'
    }]);


    <mvt:foreach iterator="item" array="basket:items">
    _joinnew.push(['setCartItem', {
    'product_id': '&mvt:item:code;',
    'qty_price': '&mvt:item:formatted_price;',
    'name': '&mvt:item:name;',
    'description': '&mvt:item:name;',
    'price': '&mvt:item:formatted_subtotal;',
    'image_url': 'PRODUCT IMAGE PATH GOES HERE'
    }]);
    </mvt:foreach>
    </script>
  • PCINET - Andreas
    Developer Partner




    • Mar 2006
    • 2439

    #2
    Re: Product Image Source URL in JavaScript on OCST Page

    If I'm not wrong and I might be, you have to use toolkit to load the image because it isn't available at this point. Check toolkit how to load the image using one of the gazillion functions <grin>.
    Andreas Toman
    PCINET, LLC

    Miva Merchant Design, Development, Integration & Support
    We built over 200 Miva Merchant stores!
    Miva shopping cart design & integration service and see our Portfolio!


    e-mail: [email protected]
    web: www.pcinet.com
    LinkedIn: Andreas Toman
    phone: (786) 250-2056 (Miami, FL)

    Comment

    • mjstonez
      Mini Mivite

      • May 2006
      • 72

      #3
      Re: Product Image Source URL in JavaScript on OCST Page

      Originally posted by PCINET - Andreas View Post
      If I'm not wrong and I might be, you have to use toolkit to load the image because it isn't available at this point. Check toolkit how to load the image using one of the gazillion functions <grin>.
      Thanks! I thought of that already and even asked Bill, he suggested an Ajax function but I thought maybe something easier would exist.

      Toolkit is certainly great, but no function for this :(

      Comment

      • PCINET - Andreas
        Developer Partner




        • Mar 2006
        • 2439

        #4
        Re: Product Image Source URL in JavaScript on OCST Page

        Uhm - this function should do it.

        <mvt:item name="toolkit" param="vproduct_find|productfound|l.all_settings:i tem:code|" />
        <mvt:if expr="NOT ISNULL l.settings:key_product:thumbnail">
        &mvte:key_product:thumbnail;
        </mvt:if>
        this should display the path to the product thumbnail.


        Grrr... watch out for blanks inthe code snippet. The forum is adding them.
        Last edited by PCINET - Andreas; 08-22-14, 08:04 AM.
        Andreas Toman
        PCINET, LLC

        Miva Merchant Design, Development, Integration & Support
        We built over 200 Miva Merchant stores!
        Miva shopping cart design & integration service and see our Portfolio!


        e-mail: [email protected]
        web: www.pcinet.com
        LinkedIn: Andreas Toman
        phone: (786) 250-2056 (Miami, FL)

        Comment

        • mjstonez
          Mini Mivite

          • May 2006
          • 72

          #5
          Re: Product Image Source URL in JavaScript on OCST Page

          Hi, Can I put that snippet right into the script where "image path goes here"? and, how about if I want the legacy main image?

          Comment

          • PCINET - Andreas
            Developer Partner




            • Mar 2006
            • 2439

            #6
            Re: Product Image Source URL in JavaScript on OCST Page

            Sure, you can use the snippet but don't add the snippet in the JavaScript but run it before the JavaScript and use else to assign a not found image. To uses the image instead of the thumbnail simply replace the word thumbnail with image.

            Let us (forum users) know if it worked.
            Andreas Toman
            PCINET, LLC

            Miva Merchant Design, Development, Integration & Support
            We built over 200 Miva Merchant stores!
            Miva shopping cart design & integration service and see our Portfolio!


            e-mail: [email protected]
            web: www.pcinet.com
            LinkedIn: Andreas Toman
            phone: (786) 250-2056 (Miami, FL)

            Comment

            • mjstonez
              Mini Mivite

              • May 2006
              • 72

              #7
              Re: Product Image Source URL in JavaScript on OCST Page

              You kind of lost me, but I'll see if I can figure that out! Thanks for your help!

              Comment

              Working...
              X