Is there a native replacement for the Toolkit randomcat function?
Announcement
Collapse
No announcement yet.
Toolkit randomcat function
Collapse
X
-
Toolkit randomcat function
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
Tags: None
-
There's nothing that does it with one line of code. But the template language can read products and make random selections, so it's possible to do it with a "paragraph" of template code.Kent Multer
Magic Metal Productions
http://TheMagicM.com
* Web developer/designer
* E-commerce and Miva
* Author, The Official Miva Web Scripting Book -- available on-line:
http://www.amazon.com/exec/obidos/IS...icmetalproducA
-
Originally posted by Kent Multer View PostThere's nothing that does it with one line of code. But the template language can read products and make random selections, so it's possible to do it with a "paragraph" of template code.
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
-
its a rather short paragraph
Code:<mvt:do name="l.settings:category_count" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_All( l.settings:all_categories )" /> <mvt:assign name="g.category_count" value="miva_array_max(l.settings:all_categories)" /> <mvt:assign name="g.category_index" value="random(g.category_count)" /> <mvt:comment> ### Debug ### </mvt:comment> all index: &mvt:global:category_index;<br> specific index:<mvt:eval expr="l.settings:all_categories[g.category_index]:id" /><br> <mvt:do file="g.Module_Library_DB" name="l.success" value="Category_Load_ID(l.settings:all_categories[g.category_index]:id, l.settings:random:category)" /> <mvt:comment> ### Debug ### </mvt:comment> &mvt:random:category:name;<br>
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
-
Bruce: I don't think that's what randomcat does, according to the documentation in the Miva app store: https://apps.miva.com/emporium-plus-tool-kit.html
Leslie: I'm curious why your clients think that a random product order would be useful. I've always figured that randomcat was just for smaller things, such as a "You may also like ..." display at the bottom of a product page.Kent Multer
Magic Metal Productions
http://TheMagicM.com
* Web developer/designer
* E-commerce and Miva
* Author, The Official Miva Web Scripting Book -- available on-line:
http://www.amazon.com/exec/obidos/IS...icmetalproducA
Comment
-
After reading the description from the UTILS TK page I am fairly sure the "randomcat" function is partially a confusing function name because it deals with the category product listing and is able to randomize the product selection in the targeted category. After glancing at Bruce's snippet, I think the logic is applicable. It's simply finding the range of indexes the array holds and randomly chooses. The only piece of code that may be missing is a method to prevent a repeat index chosen.
ScottLast edited by ids; 11-21-21, 11:54 PM.Need to offer Shipping Insurance?
Interactive Design Solutions https://www.myids.net
MivaMerchant Business Partner | Certified MivaMerchant Web Developer
Competitive Rates, Custom Modules and Integrations, Store Integration
AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
My T-shirt Collection is mostly MivaCon T-shirts!!
Comment
-
Originally posted by Kent Multer View PostBruce: I don't think that's what randomcat does, according to the documentation in the Miva app store: https://apps.miva.com/emporium-plus-tool-kit.html
Leslie: I'm curious why your clients think that a random product order would be useful. I've always figured that randomcat was just for smaller things, such as a "You may also like ..." display at the bottom of a product page.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 Bruce - PhosphorMedia View Postits a rather short paragraph
Code:<mvt:do name="l.settings:category_count" file="g.Module_Library_DB" value="Runtime_CategoryList_Load_All( l.settings:all_categories )" /> <mvt:assign name="g.category_count" value="miva_array_max(l.settings:all_categories)" /> <mvt:assign name="g.category_index" value="random(g.category_count)" /> <mvt:comment> ### Debug ### </mvt:comment> all index: &mvt:global:category_index;<br> specific index:<mvt:eval expr="l.settings:all_categories[g.category_index]:id" /><br> <mvt:do file="g.Module_Library_DB" name="l.success" value="Category_Load_ID(l.settings:all_categories[g.category_index]:id, l.settings:random:category)" /> <mvt:comment> ### Debug ### </mvt:comment> &mvt:random:category:name;<br>
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 Kent Multer View PostBruce: I don't think that's what randomcat does, according to the documentation in the Miva app store: https://apps.miva.com/emporium-plus-tool-kit.htmlLast edited by Bruce - PhosphorMedia; 11-20-21, 07:26 PM.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
-
Originally posted by ids View PostThe only piece of code that may be missing is a method to have a repeat index chosen.
Scott
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
-
Originally posted by lesliekirk View Post
Where are the product codes? The randomcat function randomizes products from a specific category.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
-
Not sure if this is relevant but in case it is useful Matt Zimmerman answered a question for me a few years ago regarding randomizing products in a product listing and it works well.
https://www.miva.com/forums/forum/de...fnt#post691053
Comment
-
Originally posted by habreu View PostNot sure if this is relevant but in case it is useful Matt Zimmerman answered a question for me a few years ago regarding randomizing products in a product listing and it works well.
https://www.miva.com/forums/forum/de...fnt#post691053Leslie 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
- 1 like
Comment
-
FYI - it WAS/IS exactly what I needed. Thank you!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
- 1 like
Comment
-
Originally posted by lesliekirk View Post
That looks like EXACTLY what I am looking for. I'll give it a show and let you know if it "works for me". Thanks!
I am trying to use the function in a Product Listing Theme Component.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
Comment