File Name: Show_ZenCart_Specials
File Submitter: lloyd_borrett
File Submitted: 28 Jun 2009
File Category: 3rd Party Integration
Snippet to let you display a random selection of specials from your ZenCart shop on an Etomite web site home page. See it in action at www.scubadoctor.com.au
# Show_ZenCart_Specials v1.0 - Etomite v0.6.1 RTM
#
# Created By: Lloyd Borrett
#
# Usage:
# Make sure the url and paths are set to the right locations for your setup.
#
# ?specials=xx
# 0 will show none! -1 will show them all.
# any other number will show up to that qualtity.
# Change $default_specialcount to the default number of items you want to see.
#
# &div=[false|0] | someclass
# if not specified then div isn't output.
# if false|0 then the div isn't output.
# any other value specified becomes the div class.
#
# &image=[false|0]
# if false|0 then the image isn't output.
# if not specified then image is output.
# anything else equates to true (default)
#
# &class=[false|0] | someclass
# if not specified then image class isn't output.
# if false|0 then the img class isn't output.
# any other value specified becomes the class.
#
# This test passing variables:
# call snippet like:
# [[Show_ZenCart_Specials?specials=10]]
# This will show 10 specials.
#
# Version history:
#
# Version 1.0 by Lloyd Borrett - 2009-06-28
Click here to download this file
[Snippet] Show_ZenCart_Specials
Started by
lloyd_borrett
, Jun 28 2009 01:44 AM
1 reply to this topic
#1
Posted 28 June 2009 - 01:44 AM
#2
Posted 28 June 2009 - 02:03 AM
G'day,
This snippet meets my needs. You might be able to adapt it to meet your needs. Best of luck.
Some of the corners I've cut are:
I've built some formatting of output into this snippet rather than using proper CSS classes.
The snippet uses some ZenCart logic to display special item prices and savings based on the way the ZenCart store it was written for is configured. This may not work for your ZenCart store. (I wasn't going to replicate all of the complicated logic ZenCart uses to handle all possible ways to do special pricing and pricing in general.)
I haven't tapped into ZenCart's image display system as yet. Thus the images being displayed are full size ones, but being displayed small. Downside is that page load overheads can increase significantly. If that's a problem, you can turn off the display of images. Alternatively, you can figure out how ZenCart's small image handling and caching system work, and use it in a new version of this snippet. If you figure it out, please let me know!
I only display this on the home page, so that test is built in. You might want to take that test out. I haven't made it an option.
I'm using "ORDER BY RAND()" in the MySQL select statement to get a random selection of the specials. This is known to be an inefficient, high overhead way to do this on large tables. It seems to be okay for the store this snippet is written for and I haven't figured out how to make any of the alternative methods work.
Please keep in mind that I'm not available much these days to help with fixing problems you may have using my snippets, or adapting them to suit your needs.
This snippet meets my needs. You might be able to adapt it to meet your needs. Best of luck.
Some of the corners I've cut are:
I've built some formatting of output into this snippet rather than using proper CSS classes.
The snippet uses some ZenCart logic to display special item prices and savings based on the way the ZenCart store it was written for is configured. This may not work for your ZenCart store. (I wasn't going to replicate all of the complicated logic ZenCart uses to handle all possible ways to do special pricing and pricing in general.)
I haven't tapped into ZenCart's image display system as yet. Thus the images being displayed are full size ones, but being displayed small. Downside is that page load overheads can increase significantly. If that's a problem, you can turn off the display of images. Alternatively, you can figure out how ZenCart's small image handling and caching system work, and use it in a new version of this snippet. If you figure it out, please let me know!
I only display this on the home page, so that test is built in. You might want to take that test out. I haven't made it an option.
I'm using "ORDER BY RAND()" in the MySQL select statement to get a random selection of the specials. This is known to be an inefficient, high overhead way to do this on large tables. It seems to be okay for the store this snippet is written for and I haven't figured out how to make any of the alternative methods work.
Please keep in mind that I'm not available much these days to help with fixing problems you may have using my snippets, or adapting them to suit your needs.
Edited by lloyd_borrett, 28 June 2009 - 02:03 AM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











