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

Shop by Price feature?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 03-05-2004, 08:49 AM
 
GM GM is offline
 

eXpert
  
Join Date: Mar 2004
Location: Canada
Posts: 293
 

Default Shop by Price feature?

I want to enable the customer to "Shop by Price". Basically, the same thing as the advanced search page, without the "product title"... just the "price" and "category". (linked to the speedbar or whatever) I'm a total newb when it comes to smarty. Can I copy the advanced search page and somehow remove the "product Title" part? Any help?
Reply With Quote
  #2  
Old 03-05-2004, 09:06 AM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

http://forum.x-cart.com/viewtopic.php?t=4222

Wrong forum my friend.

Try Order Management.
Reply With Quote
  #3  
Old 03-05-2004, 01:15 PM
 
GM GM is offline
 

eXpert
  
Join Date: Mar 2004
Location: Canada
Posts: 293
 

Default

Ok... here's what I did, I made a new .tpl in customer/main/ called price_search.tpl with the following code:

Code:
{* $Id: price_search.tpl,v 1.5 2003/11/12 10:26:28 svowl Exp $ *} {include file="location.tpl" last_location=$lng.lbl_advanced_search} {capture name=adv_search} <table border=0> <form action="searchprice.php" name="productsearchbyprice_form"> </tr> <tr><td>{$lng.lbl_price}, {$config.General.currency_symbol}</td> <td><input type="text" name="price_search_1" size="6" value="{$smarty.get.price_search_1|escape}"> - <input type="text" name="price_search_2" size="6" value="{$smarty.get.price_search_2|escape}"></td></tr> <tr><td>{$lng.lbl_category}</td> <td> <select name="in_category"> <option value="">All</option> {section name=cat_num loop=$categories} <option value="{ $categories[cat_num].categoryid}" {if $smarty.get.in_category eq $categories[cat_num].categoryid or $cat eq $categories[cat_num].categoryid}selected{/if}>{$categories[cat_num].category|escape}</option> {/section} </select> </td> </tr> <tr><td colspan=2></td></tr> <tr> <td></td> <td>{include file="buttons/search.tpl" style="button" type="input"}</td></tr> </form> </table> {/capture} {include file="dialog.tpl" title=$lng.lbl_advanced_search content=$smarty.capture.adv_search extra="width=100%"}

I also made a copy of search.php and renamed it searchprice.php changing it as follows:
Code:
<?php /*****************************************************************************\ +-----------------------------------------------------------------------------+ | X-Cart | | Copyright (c) 2001-2004 Ruslan R. Fazliev <rrf@rrf.ru> | | All rights reserved. | +-----------------------------------------------------------------------------+ | PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" | | FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE | | AT THE FOLLOWING URL: http://www.x-cart.com/license.php | | | | THIS AGREEMENT EXPRESSES THE TERMS AND CONDITIONS ON WHICH YOU MAY USE | | THIS SOFTWARE PROGRAM AND ASSOCIATED DOCUMENTATION THAT RUSLAN R. | | FAZLIEV (hereinafter referred to as "THE AUTHOR") IS FURNISHING OR MAKING | | AVAILABLE TO YOU WITH THIS AGREEMENT (COLLECTIVELY, THE "SOFTWARE"). | | PLEASE REVIEW THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT | | CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE. BY INSTALLING, | | COPYING OR OTHERWISE USING THE SOFTWARE, YOU AND YOUR COMPANY | | (COLLECTIVELY, "YOU") ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS | | LICENSE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY THIS | | AGREEMENT, DO NOT INSTALL OR USE THE SOFTWARE. VARIOUS COPYRIGHTS AND | | OTHER INTELLECTUAL PROPERTY RIGHTS PROTECT THE SOFTWARE. THIS | | AGREEMENT IS A LICENSE AGREEMENT THAT GIVES YOU LIMITED RIGHTS TO USE | | THE SOFTWARE AND NOT AN AGREEMENT FOR SALE OR FOR TRANSFER OF TITLE.| | THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT. | | | | The Initial Developer of the Original Code is Ruslan R. Fazliev | | Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2004 | | Ruslan R. Fazliev. All Rights Reserved. | +-----------------------------------------------------------------------------+ \*****************************************************************************/ # # $Id: searchprice.php,v 1.50.2.6 2004/02/05 12:25:45 mclap Exp $ # require "./auth.php"; require $xcart_dir."/include/categories.php"; $tmp=strstr($QUERY_STRING, "$XCART_SESSION_NAME="); if (!empty($tmp)) $QUERY_STRING=ereg_replace("$XCART_SESSION_NAME=([0-9a-zA-Z]*)", "", $QUERY_STRING); if(!empty($QUERY_STRING)) { # # Perform SQL search query # $substring = trim($substring); $price_condition = @$price_search_1?" AND $sql_tbl[pricing].price>='$price_search_1'":""; $price_condition .= @$price_search_2?" AND $sql_tbl[pricing].price<='$price_search_2'":""; $price_substring = @$price_search_1?"&price_search_1=".urlencode($price_search_1):""; $price_substring .= @$price_search_2?"&price_search_2=".urlencode($price_search_2):""; if ($price_condition) $sort_by_price = "price"; if (@$in_category) { $search_category = addslashes(array_pop(func_query_first("select category from $sql_tbl[categories] where categoryid='$in_category'"))); $search_categories = func_query("select categoryid from $sql_tbl[categories] where $sql_tbl[categories].category like '$search_category%'"); if(is_array($search_categories)) { $category_condition=" in ( "; foreach($search_categories as $k=>$v) $category_condition .= "'$v[categoryid]', "; $category_condition = ereg_replace(", $", ")", $category_condition); $category_condition=" ($sql_tbl[products].categoryid $category_condition or $sql_tbl[products].categoryid1 $category_condition or $sql_tbl[products].categoryid2 $category_condition or $sql_tbl[products].categoryid3 $category_condition) "; } } else $category_condition = "1"; $membership_condition = " AND ($sql_tbl[categories].membership='". @$user_account['membership']."' OR $sql_tbl[categories].membership='') "; if ($store_language != $config["default_customer_language"] && $substring) { $substring_query = "AND (($sql_tbl[products].product like '%$substring%' or $sql_tbl[products].descr like '%$substring%' or $sql_tbl[products].fulldescr like '%$substring%') OR ($sql_tbl[products_lng].code='$store_language' AND ($sql_tbl[products_lng].product LIKE '%$substring%' OR $sql_tbl[products_lng].descr LIKE '%$substring%' OR $sql_tbl[products_lng].full_descr LIKE '%$substring%')))"; $search_query_count = "select count(*) from $sql_tbl[pricing], $sql_tbl[categories], $sql_tbl[products] LEFT JOIN $sql_tbl[products_lng] ON $sql_tbl[products].productid=$sql_tbl[products_lng].productid where $sql_tbl[pricing].productid=$sql_tbl[products].productid and $sql_tbl[pricing].quantity=1 and $sql_tbl[products].categoryid=$sql_tbl[categories].categoryid $membership_condition and ($sql_tbl[pricing].membership='". $user_account['membership']."' or $sql_tbl[pricing].membership='') AND $category_condition and $sql_tbl[products].forsale='Y' and $sql_tbl[categories].avail='Y' $price_condition $substring_query group by $sql_tbl[products].productid"; } else { $substring_query = "AND ($sql_tbl[products].product like '%$substring%' OR $sql_tbl[products].descr like '%$substring%' OR $sql_tbl[products].fulldescr like '%$substring%')"; $search_query_count = "select count(*) from $sql_tbl[products], $sql_tbl[pricing], $sql_tbl[categories] where $sql_tbl[pricing].productid=$sql_tbl[products].productid and $sql_tbl[pricing].quantity=1 and $sql_tbl[products].categoryid=$sql_tbl[categories].categoryid $membership_condition and ($sql_tbl[pricing].membership='".@$user_account['membership']."' or $sql_tbl[pricing].membership='') AND $category_condition and $sql_tbl[products].forsale='Y' and $sql_tbl[categories].avail='Y' $price_condition $substring_query group by $sql_tbl[products].productid"; } $search_query = "$category_condition and $sql_tbl[categories].avail='Y' and $sql_tbl[products].forsale='Y' $price_condition $substring_query "; $tmp = func_query($search_query_count); $total_products_in_search = is_array($tmp)?count($tmp):0; # # Navigation code # $objects_per_page = $config["Appearance"]["products_per_page"]; $total_nav_pages = ceil($total_products_in_search/$objects_per_page)+1; require $xcart_dir."/include/navigation.php"; $smarty->assign("products",func_search_products($search_query, @$user_account['membership'],$first_page,$total_products_in_search, 0, @$sort_by_price)); $smarty->assign("navigation_script","search.php?substring=".urlencode($substring)."&in_category=".@$in_category."".$price_substring); $HTTP_GET_VARS["substring"] = stripslashes($HTTP_GET_VARS["substring"]); $smarty->assign("main","price_search"); } else { $smarty->assign("main","price_search"); } $smarty->display("customer/home.tpl"); ?>

By all of my practical thinking this should work shouldn't it? The problem is that I get a permission denied/file not found error?? What gives? File permissions are the same as the origional files (so that's not the problem) is it possible that the DB is rejecting the calls? Please help?
Reply With Quote
  #4  
Old 03-05-2004, 03:37 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Complete Mods please.

If you are trying to modify something please post elsewhere. The Moderators will move it to here when it is finalised and working.
Reply With Quote
  #5  
Old 03-05-2004, 03:52 PM
 
GM GM is offline
 

eXpert
  
Join Date: Mar 2004
Location: Canada
Posts: 293
 

Default

N.P.
Reply With Quote
  #6  
Old 03-05-2004, 04:24 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

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

Default

Shop by price, just {include file="/customer/foo.tpl"} in home.tpl

Code:
{capture name=menu} $1-$100 $100-$250 $250-$500 $500-$1000 $1000-$10000 {/capture} { include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title="Price Range" menu_content=$smarty.capture.menu }

Just edit the ranges to better fit your products/customers.
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #7  
Old 03-05-2004, 05:04 PM
 
GM GM is offline
 

eXpert
  
Join Date: Mar 2004
Location: Canada
Posts: 293
 

Default

Warning: filemtime(): Stat failed for /customer/foo.tpl (errno=2 - No such file or directory) in /home/www/"mydomain"/Smarty-2.5.0/Smarty.class.php on line 1650

I created the foo.tpl in /customer/ ????

It works ok in preview mode but it's not quite what I'm looking for.
My version allows you to input text price and search a catagory, if I could only get rid of the permission denied error?
Reply With Quote
  #8  
Old 03-05-2004, 08:02 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

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

Default

put foo.tpl in skin1/customer/foo.tpl

edit the include in skin1/customer/home.tpl

{include file="customer/foo.tpl"}
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #9  
Old 03-06-2004, 07:04 AM
 
GM GM is offline
 

eXpert
  
Join Date: Mar 2004
Location: Canada
Posts: 293
 

Default

Thanks BOOMER... You rock!
Reply With Quote
  #10  
Old 03-07-2004, 09:45 PM
 
Lingerieblowout Lingerieblowout is offline
 

X-Adept
  
Join Date: Sep 2003
Location: Annapolis, MD
Posts: 415
 

Default Confused

Okay I'm glad GM got it to work but i get the same error.

Warning: filemtime(): Stat failed for /customer/foo.tpl (errno=2 - No such file or directory) in /home/lingeri/public_html/Smarty-2.5.0/Smarty.class.php on line 1650

I have the foo.tpl in: skin1/customer

and the include statement in: skin1/customer/home.tpl

I tried: { include file="/customer/foo.tpl"}
and { include file="customer/foo.tpl"}

Is that the right place for it

Thanks
Michael

http://www.lingerieblowout.com
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 08:38 AM.

   

 
X-Cart forums © 2001-2020