Technology TidBits

Answers to various technical questions on php programming, mysql, linux, and many more categories.
25% off Hosting at HostGator.com:
Use Code techbits25



How do I add a new sort method for my products (SunShop 4.x)

Last updated: 06/23/2009

In the admin area, you can select the "Default Item Order" for your items.  One option missing is to sort by sku, but there are other ways you might like to sort.  Here's a quick way to update that list.

Edit the "adminindex.php " (/admin folder on your site)

Find a line that looks something like this:

$form .= $forms->item("dropdown", help($lang['defaulti'], $lang['defaulti_d']), "orderby", $forms->farray(array("title asc","num_sold desc","price asc","price desc","id asc","id desc"), array($lang['alhpa'],$lang['mostpop'],$lang['pricelow'],$lang['pricehigh'],$lang['agenew'],$lang['ageold'])), $settings[orderby]);

Now, you can add options by looking up the proper database field.  The bolded items below show how I added "SKU" as an option in the dropdown:

$form .= $forms->item("dropdown", help($lang['defaulti'], $lang['defaulti_d']), "orderby", $forms->farray(array("title asc","num_sold desc","price asc","price desc","id asc","id desc","sku asc"), array($lang['alhpa'],$lang['mostpop'],$lang['pricelow'],$lang['pricehigh'],$lang['agenew'],$lang['ageold'],"SKU")), $settings[orderby]);

Need help doing this yourself?  Contact me for consulting help.

-Jim

blog comments powered by Disqus
Have your own Tech-bit to contribute? Submit it here

Other questions in this category:
My shopping cart disappears, or doesn't clear out properly when going from non-secure to the secure server - what's wrong?
How can I figure out which template does what in SunShop?
UPS module not working on php 5
In Sunshop 3.5, the 'Update Cart' button clears out my cart!
How do I secure the "tell a friend" feature of SunShop 3.5.1?
How to upgrade from Sunshop 3.5 to Sunshop 4.x by making a parallel copy of the software.
How can I remove the "(Add $)" from my product options?
Why does my shop keep displaying the home page no matter what products I click on?
How do I edit the "related products" template in Sunshop 4?
Coupons by product / item don't seem to work on the 4.2 and 4.3 releases
My image verification is broken on the contact page - why?
On 1&1 hosting, I can't get Zend to work with Sunshop
Some of my pages get a "Error parsing template" when generating HTML pages in Sunshop
How can I add extra fields to my Sunshop Contact form that are not required?
How can I get the ioncube loaders working with GoDaddy?



Powered by KnowledgebasePublisher 1.1
Host Gator
Content provided by Roberts WebForge, Inc.