Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

3.5.7 Product Sort Solution

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 05-15-2004, 02:35 AM
 
arabayaservis.com arabayaservis.com is offline
 

Member
  
Join Date: Nov 2003
Posts: 10
 

Default 3.5.7 Product Sort Solution

customer/products.php


old;
Code:
$products = func_search_products($search_query, !empty($user_account['membership'])?$user_account['membership']:"", $first_page,$current_category["product_count"]);

new:
Code:
$products = func_search_products($search_query, !empty($user_account['membership'])?$user_account['membership']:"", $first_page,$current_category["product_count"],0,$orderby);

old;
Code:
$smarty->assign("products",$products);

new
Code:
$smarty->assign("orderby",$orderby); $smarty->assign("products",$products);


customer/home.php?cat=105&orderby=price

you will see sorting products
Reply With Quote
  #2  
Old 05-15-2004, 03:42 AM
 
laureon laureon is offline
 

Senior Member
  
Join Date: Oct 2003
Posts: 171
 

Default

good little mod, how might we go about sorting by price ascending rather than the default descending?
__________________
X-Cart Gold Version: 4.0.17
X-Configurator
X-AOM
X-FancyCategories
X-RMA
X-Offers
Reply With Quote
  #3  
Old 05-15-2004, 04:18 AM
 
arabayaservis.com arabayaservis.com is offline
 

Member
  
Join Date: Nov 2003
Posts: 10
 

Default

please goto admin area and click to general settings

select apperance options

find : List products in reversed order

check/uncheck <-> asc/dsc

ok?
Reply With Quote
  #4  
Old 05-15-2004, 04:23 AM
 
arabayaservis.com arabayaservis.com is offline
 

Member
  
Join Date: Nov 2003
Posts: 10
 

Default

customer/main/sortProduct.tpl (new page, please add)

Code:
{literal} <script Language="Javascript"> function sortOnh(sortTypeNameOnh){ {/literal} document.location.href = "{$smarty.server.PHP_SELF}?cat={$cat}&page=1&orderby="+sortTypeNameOnh; {literal} } </script> {/literal} <table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><form name="srchFrmOnh"><td align="right"><select name="srchTypeOnh" OnChange="sortOnh(this.value)"> {if $orderby eq "product"} <option selected value="product">Product Sort</option> {else} <option value="product">Product Sort</option> {/if} {if $orderby eq "price"} <option selected value="price">Price Sort</option> {else} <option value="price">Price Sort</option> {/if} {if $orderby eq "add_date"} <option selected value="add_date">Add Date Sort</option> {else} <option value="add_date">Add Date Sort</option> {/if} </select> </td></form></tr></table>


customer/main/products.tpl

add new line on top or whereever you want

Code:
{if $products} {if $main eq "catalog"} {include file="customer/main/sortProduct.tpl"} {/if} {/if}

Little but important mod from Turkey!
Reply With Quote
  #5  
Old 05-20-2004, 11:51 AM
 
xcell67 xcell67 is offline
 

Senior Member
  
Join Date: Dec 2003
Posts: 149
 

Default

I found this in include/func.php:

Code:
# array_multisort($result_p,($orderby=="orderby" && $config["Appearance"]["product_order_reversed"]=="Y"?SORT_DESC:SORT_ASC),SORT_STRING, $productorderbys,($orderby=="orderby" && $config["Appearance"]["product_order_reversed"]=="Y"?SORT_DESC:SORT_ASC),SORT_NUMERIC,$productorderbyname,SORT_STRING); array_multisort($result_p,($config["Appearance"]["product_order_reversed"]=="Y"?SORT_DESC:SORT_ASC),SORT_STRING,$productorderbys,($config["Appearance"]["product_order_reversed"]=="Y"?SORT_DESC:SORT_ASC),SORT_REGULAR,$productorderbyname,SORT_STRING);

My question is, how can we add a drop down menu so the user can choose to have the product sort displayed as ascending or descending?
Reply With Quote
  #6  
Old 05-20-2004, 12:06 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

http://www.cart-lab.com/lab/customer/product.php?productid=7

Product Sort, with ascending,descending dropdowns as well as configurable field types or fields from the products database dynamically.

Demo: http://www.cart-lab.com/lab/customer/search.php?substring=
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #7  
Old 05-20-2004, 04:14 PM
 
xcell67 xcell67 is offline
 

Senior Member
  
Join Date: Dec 2003
Posts: 149
 

Default

thanks for the recommendation boomer but I've already got the product sort down thanks to the mod above, the only thing I need is the Ascending/Descending bit.

nice looking site by the way =)
Reply With Quote
  #8  
Old 07-19-2004, 11:53 AM
 
shua shua is offline
 

Member
  
Join Date: Mar 2004
Posts: 15
 

Default mod modification?

cool mod, very handy, but when there are multiple pages (as in a list that goes beyond the users prefered quantity per page) the sorting breaks (ie, returns to alphebetical by title)

Any thoughts on how to remedy this?
Reply With Quote
  #9  
Old 07-19-2004, 11:58 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

The Max Nav. pages shouldn't ever got past, I don't get what you mean exactly?
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #10  
Old 07-19-2004, 12:27 PM
 
shua shua is offline
 

Member
  
Join Date: Mar 2004
Posts: 15
 

Default let me rephrase

Hey Boomer.

What I mean is that I sort by lets say price. There are 51 products in my category, 10 are displayed at a time. To view the next 10 you must click the small arrow or the page number. I have been working on getting these links to use the sort code from above, but have been unsuccessful so far.

does that clear it up?

Thanks for the quick reply!!!
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:38 PM.

   

 
X-Cart forums © 2001-2020