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?
Announcement
Collapse
No announcement yet.
Quicklist - Add a comma after each list item on display
Collapse
X
-
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.Leslie Kirk
Miva Certified Developer
Miva Merchant Specialist since 1997
Previously of Webs Your Way (aka Leslie Nord leslienord)
Email me: [email protected]
www.lesliekirk.com
Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr
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?Leslie Kirk
Miva Certified Developer
Miva Merchant Specialist since 1997
Previously of Webs Your Way (aka Leslie Nord leslienord)
Email me: [email protected]
www.lesliekirk.com
Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr
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.
Leslie Kirk
Miva Certified Developer
Miva Merchant Specialist since 1997
Previously of Webs Your Way (aka Leslie Nord leslienord)
Email me: [email protected]
www.lesliekirk.com
Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr
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.Bruce Golub
Phosphor Media - "Your Success is our Business"
Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
phosphormedia.com
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.
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.David Carver
Miva, Inc. | Software Developer
Comment
Comment