Announcement
Collapse
No announcement yet.
Quicklist - Add a comma after each list item on display
Collapse
X
-
You'd could probably use an mvt:capture to and then only use mvt:evals inside of the capture? Otherwise you'd probably need to use <mvt:miva output="off" /> and then do <mvt:eval /> all the other data. <mvt:capture> may also work.
-
Got it.
Thank you for the explanation and your code evaluates faster.
Leave a comment:
-
alphabet my code does avoid the comma at the end. We are outputting the comma BEFORE we output any data for the loop. So if we are on the last element, and the last element position isn't one, we output a comma so it goes <element>,<last_element> where the comma and <last_element> all occur in the last iteration of the loop.
Leave a comment:
-
dcarver I just want to make sure I understand l.pos, wouldn't he want to avoid the comma at the end?
Code:<mvt:foreach ...> All your other code here... <mvt:if expr="l.pos1 NE miva_array_elements(array)" >,</mvt:if> </mvt:foreach>
Also, if you have nested loops, the inner loop becomes l.pos2 etc.
Leave a comment:
-
Not sure of the particular here since i never used toolkit much, but, doesn't toolkit accept global variables? If so, just use the Product_Read() custom field function to create a global that can be read by toolkit.
Leave a comment:
-
Originally posted by Scot - ScotsScripts.com View PostYes :) I'm just not clear what your starting condition is. If the codes are already in the custom field then it would be easy to turn them into an array and use a foreach to roll through them.
I'm tagging along on this thread to see if there is a much better way to do this that would allow me to use custom fields and mivascript instead of the Toolkit.
Leave a comment:
-
Yes :) I'm just not clear what your starting condition is. If the codes are already in the custom field then it would be easy to turn them into an array and use a foreach to roll through them.
Leave a comment:
-
Originally posted by Scot - ScotsScripts.com View PostAre you saying you have a custom field already populated with comma separated product codes, or are you trying to dynamically load product codes into a custom field on the page using template scripting?
Leave a comment:
-
Are you saying you have a custom field already populated with comma separated product codes, or are you trying to dynamically load product codes into a custom field on the page using template scripting?
Leave a comment:
-
Originally posted by eldon99 View PostI am building a quicklist on the product page with a comma separate list of related product codes. I need to be able to separate each list item with a comma on the page (as opposed to line breaks). I looked at the pos1 docs, but if my theory is correct, I will end up having a comma after the last item. How can I avoid that?
Code:<mvt:item name="toolkit" param="quick|pcount|&mvt:customfield_values:customfields:madness;" />
Anywho, I'm tagging along to see if I can glean some insight.
Leave a comment:
-
Code:<mvt:foreach ...> <mvt:if expr="l.pos1 GT 1"> , </mvt:if> All your other code here... </mvt:foreach>
Leave a comment:
-
Quicklist - Add a comma after each list item on display
I am building a quicklist on the product page with a comma separate list of related product codes. I need to be able to separate each list item with a comma on the page (as opposed to line breaks). I looked at the pos1 docs, but if my theory is correct, I will end up having a comma after the last item. How can I avoid that?Tags: None
Leave a comment: