Announcement

Collapse
No announcement yet.

Recently Viewed Products - Part Deux

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

  • RTHOMASDESIGN
    replied
    Glad you got it working! Should be pretty easy to add an "add to cart" button. :)

    Leave a comment:


  • lesliekirk
    replied
    Originally posted by RTHOMASDESIGN View Post
    You've got a space after customfield_values. That said, if you check the token list in PROD, I doubt you'd find the custom field available (unless you read it). Something like this should work:
    <mvt:item name="customfields" param="Read_Product_Code( l.settings:recent_product:code, 'product_flag', g.productflag )" />
    <mvt:if expr="g.productflag NE 'none' AND l.settings:recent_product:inv_level NE 'out'">
    <mvt:assign name="l.settings:recent_product:flag" value="'flag-s--' $ tolower(g.productflag)" />
    <mvt:else>
    <mvt:assign name="l.settings:recent_product:flag" value="'flag-s--out_of_stock'" />
    </mvt:if>
    &mvt:recent_product:flag;
    <span class="flag-s &mvt:recent_product:flag;">
    <img class="x-product-list__image" src="&mvt:recent_product:src;" alt="&mvt:recent_product:name;">
    </span>
    This "<mvt:assign name="l.settings:recent_product:flag" value="'flag-s--out_of_stock'" />" would always work as the condition wasn't met.

    That space happened when I pasted it here. Thanks, once I removed the extra &mvt:recent_product:flag; it's what I was trying to achieve.

    Leave a comment:


  • RTHOMASDESIGN
    replied
    You've got a space after customfield_values. That said, if you check the token list in PROD, I doubt you'd find the custom field available (unless you read it). Something like this should work:

    <mvt:item name="customfields" param="Read_Product_Code( l.settings:recent_product:code, 'product_flag', g.productflag )" />
    <mvt:if expr="g.productflag NE 'none' AND l.settings:recent_product:inv_level NE 'out'">
    <mvt:assign name="l.settings:recent_product:flag" value="'flag-s--' $ tolower(g.productflag)" />
    <mvt:else>
    <mvt:assign name="l.settings:recent_product:flag" value="'flag-s--out_of_stock'" />
    </mvt:if>
    &mvt:recent_product:flag;
    <span class="flag-s &mvt:recent_product:flag;">
    <img class="x-product-list__image" src="&mvt:recent_product:src;" alt="&mvt:recent_product:name;">
    </span>

    This "<mvt:assign name="l.settings:recent_product:flag" value="'flag-s--out_of_stock'" />" would always work as the condition wasn't met.

    Leave a comment:


  • lesliekirk
    replied
    Originally posted by RTHOMASDESIGN View Post
    You can read the custom field in the template loop (within <mvt:foreach iterator="recent_product" array="recently_viewed:products">).
    <mvt:item name="customfields" param="Read_Product_Code( l.settings:recent_product:code, 'yourcustomfieldcode', g.yourcustomfieldcode)" />
    &mvt:global:yourcustomfieldcode;

    <mvt:item name="customfields" param="Read_Product_Code( l.settings:recent_product:code, 'product-flag', g.productflag)" />
    &mvt:global:productflag;

    Hope this helps!
    -Ryan
    Thanks. I understand what you are showing me but now I am baffled as to why what I had tried works "halfway". The out_of_stock flag displays as needed


    Code:
    <mvt:if expr="l.settings:recent_product:customfield_values :customfields:product_flag NE 'none' AND l.settings:recent_product:inv_level NE 'out'">
    <mvt:assign name="l.settings:recent_product:flag" value="'flag-s--' $ tolower(l.settings:recent_product:customfield_values:customfields:product_flag)" />
    <mvt:else>
    <mvt:assign name="l.settings:recent_product:flag" value="'flag-s--out_of_stock'" />
    </mvt:if>
    
    <span class="flag-s &mvt:recent_product:flag;">
    <img class="x-product-list__image" src="&mvt:recent_product:src;" alt="&mvt:recent_product:name;">
    </span>

    Leave a comment:


  • RTHOMASDESIGN
    replied
    You can read the custom field in the template loop (within <mvt:foreach iterator="recent_product" array="recently_viewed:products">).
    <mvt:item name="customfields" param="Read_Product_Code( l.settings:recent_product:code, 'yourcustomfieldcode', g.yourcustomfieldcode)" />
    &mvt:global:yourcustomfieldcode;

    <mvt:item name="customfields" param="Read_Product_Code( l.settings:recent_product:code, 'product-flag', g.productflag)" />
    &mvt:global:productflag;

    Hope this helps!
    -Ryan

    Leave a comment:


  • lesliekirk
    started a topic Recently Viewed Products - Part Deux

    Recently Viewed Products - Part Deux

    I've been working with implementing SteveoSoule Recently Viewed Products https://gist.github.com/steveosoule/...f614b9b2927741

    I would like to add the Product Flags custom field to the layout and an Add to Cart button. LOL, there are other things that would be great but how do I at least get the Product Flags Custom Field?

    Thanks!
Working...
X