I've successfully created a "My Favorites" list using Toolkit and have modified PROD/ACLN accordingly to get it to work how I want with one exception. Based on how Toolkit adds items to the custom customer field, my product page snippet isn't updating as I'd like. The site is still offline in preparation for launch so I can't show the actual page but below is the code and a quick explanation of what it does and what I'd like it to do...
So here's what happens... When the product page loads it checks for a logged in customer. If there is one it displays the Toolkit functions for the Favorites List. It also checks the customers current Favorites List in order to display the relevant links. For example, if the current product is in the customers list it will display the remove link while deactivating the add link. Likewise, if it's not in the list, it will then display the add link while deactivating the remove link.
This all functions fine for the actual Favorites List but I'm running into trouble having the product page accurately reflect the addition or removal of the item. When clicking either link, the page refreshes and Toolkit performs the function of adding/removing it on the list. However, the link is still active because the logic checking for the item on the list executes before the Toolkit function. A second click on the link or additional page refresh is necessary in order for it to update the links accordingly, deactivating one link and activating the other.
I've tried a number of things without success and the adding/removing works fine while keeping the customer on the product page. It's now just a matter of getting those fields to update accordingly when the page refreshes for the Toolkit function. I didn't want to bother Bill with a support ticket as the functions are working so hopefully someone has an idea or solution for the page updating that I overlooked.
Any help you can offer is greatly appreciated.
Thanks,
Tim
Code:
<mvt:if expr="g.basket:cust_id GT 0"> <mvt:item name="customfields" param="Read_Customer_ID( g.basket:cust_id, 'myfavs', l.settings:customfields )" /> <mvt:if expr = " l.settings:product:code IN l.settings:customfields "> <i class="icon-plus-sign-alt"></i> Add to MyFavorites | <i class="icon-minus-sign-alt"></i> <a href="&mvte:global:sessionurl;Screen=PROD&Product_Code=&mvta:global:Product_Code&Category_Code=&mvta:global:Category_Code;&Store_Code=&mvta:global:store_code;&favdelete=&mvta:global:Product_Code;">Remove from MyFavorites</a> | <mvt:if expr="g.favdelete"> <mvt:item name="toolkit" param="custdelete|myfavs|g.favdelete" /> </mvt:if> <mvt:else> <i class="icon-plus-sign-alt"></i> <a href="&mvte:global:sessionurl;Screen=PROD&Product_Code=&mvta:global:Product_Code;&Category_Code=&mvta:global:Category_Code;&Store_Code=&mvta:global:store:code;&favorite=&mvta:global:Product_Code;">Add to MyFavorites</a> | <mvt:if expr="g.favorite"> <mvt:item name="toolkit" param="custadd|myfavs|g.favorite" /> </mvt:if> <i class="icon-minus-sign-alt"></i> Remove from MyFavorites | </mvt:if> <i class="icon-list-alt"></i> <mvt:item name="cssui_links" param="customer_account">View/Manage MyFavorites</mvt:item> </mvt:if>
This all functions fine for the actual Favorites List but I'm running into trouble having the product page accurately reflect the addition or removal of the item. When clicking either link, the page refreshes and Toolkit performs the function of adding/removing it on the list. However, the link is still active because the logic checking for the item on the list executes before the Toolkit function. A second click on the link or additional page refresh is necessary in order for it to update the links accordingly, deactivating one link and activating the other.
I've tried a number of things without success and the adding/removing works fine while keeping the customer on the product page. It's now just a matter of getting those fields to update accordingly when the page refreshes for the Toolkit function. I didn't want to bother Bill with a support ticket as the functions are working so hopefully someone has an idea or solution for the page updating that I overlooked.
Any help you can offer is greatly appreciated.
Thanks,
Tim
Comment