Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] shop by price


Guest

Recommended Posts

I have added an infobox for shopping by price. It displays a list of price ranges the shopper can click to give an alternative way to shop.

 

I used it for a gift shop application where the shopper can quickly find a gift in the price range they want to give.

 

It is based on MS1.

Link to comment
Share on other sites

  • Replies 82
  • Created
  • Last Reply

Top Posters In This Topic

Hi Meltus:

 

It doesn't work for me. All seems to be Ok but if you click any option, nothing is displayed, only in the top, the number of articles found in each brand, but no the articles description or image... a center blank page... :(

Link to comment
Share on other sites

are you using the product_listing.php that comes as default - or has it been altered?

 

If you have changed your includes/modules/product_listing.php then it might not work.

 

If you PM or post your web address I can have a look ....

Link to comment
Share on other sites

actually - i've just looked at the code - and its me using the modified product_listing.php

 

that's not in the contribution - I shall add it now.

 

Slap wrists

Link to comment
Share on other sites

Hi Meltus:

 

It appears to be a msql syntax error, may be?. This appears when you click on the icon arrow of the box.

 

1064 - Algo est? equivocado en su sintax cerca '' en la linea 1



select count(*) as total from products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join products_description pd on p.products_id = pd.products_id and pd.language_id = '3' left join specials s on p.products_id = s.products_id where p.products_status = '1' and



[TEP STOP]

Link to comment
Share on other sites

i wish i had tested this better !

 

replace in catalog/includes/boxes/shop_by_price.php

 

 new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SHOP_BY_PRICE, '', 'NONSSL'));

 

 

with

 

new infoBoxHeading($info_box_contents, false, false);

 

did you download the later version of the code I put on contributions - this fixes the problem with the modified product_listing.

 

I won't put this latest dropped clanger in contributions yet - just in case I've missed something else.

Link to comment
Share on other sites

I have just download and install the new contrib, and now works :D , but there are two "forgotten strings" in languagesenglishshop_by_price.php:

 

define('TABLE_HEADING_BUY_NOW', 'Buy Now');

define('TABLE_HEADING_PRICE', 'Price');

 

For all who have activated the "buy now" button...

 

If you want you can add the shop_by_price.php in Spanish to the contrib in your next package... here is:

 

<?php

/*

 $Id: shop_by_price.php,v 1.0 2003/5/26  $

 

 Contribution by Meltus

 http://www.highbarn-consulting.com

 

 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2003 osCommerce



 Released under the GNU General Public License

*/



define('NAVBAR_TITLE', 'Compra por precio');

define('HEADING_TITLE', 'Compra por precio');

define('BOX_HEADING_SHOP_BY_PRICE', 'Que hay por');

define('TABLE_HEADING_IMAGE', '');

define('TABLE_HEADING_MODEL', 'Modelo');

define('TABLE_HEADING_PRODUCTS', 'Productos');

define('TABLE_HEADING_MANUFACTURER', 'Fabricante');

define('TABLE_HEADING_QUANTITY', 'Cantidad');

define('TABLE_HEADING_BUY_NOW', 'Compre Ahora');

define('TABLE_HEADING_PRICE', 'Precio');



$price_ranges = Array(  "Menos de 30Eur", 

     "De 30 a 60Eur", 

     "De 60 a 100Eur", 

     "M?s de 100Eur " );

     

$price_ranges_sql = Array(  "p.products_price < 30", 

    	 "(p.products_price <= 60 and p.products_price >= 30)", 

    	 "(p.products_price <= 100 and p.products_price >= 60)", 

    	 "p.products_price >= 100");



?>

 

You can replace the "Eur" for the Eur symbol ?

Link to comment
Share on other sites

and also if somebody don't like the product listing in column, you can change the FILENAME_PRODUCT_LISTING in line 171 of shop_by_price.php to FILENAME_PRODUCT_LISTING_COL, i think this will be much better ( but you have to install FPRODUCT LISTING COOl contri. first).

 

 

sean

Link to comment
Share on other sites

a php tag with the correct currency code would improve this mod a lot. if i knew how i would do it myself... :(

 

just a though...

Link to comment
Share on other sites

i have a fix now for this shop_by_price mod - with multicurrencies. This fix will allow box to show the shoppers selected currency. the only problem that i can't fix is the decimal point. it wants to show 99.00 instead of 99... here is the fix for the english/shop_by_price.php portion of the mod:

 

<?php

/*

$Id: shop_by_price.php,v 1.0 2003/5/26 $

 

Contribution by Meltus

http://www.highbarn-consulting.com

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

define('NAVBAR_TITLE', 'Shop by Price');

define('HEADING_TITLE', 'Shop by Price');

define('BOX_HEADING_SHOP_BY_PRICE', 'Shop By Price');

define('TABLE_HEADING_IMAGE', '');

define('TABLE_HEADING_MODEL', 'Model');

define('TABLE_HEADING_PRODUCTS', 'Product Name');

define('TABLE_HEADING_MANUFACTURER', 'Manufacturer');

define('TABLE_HEADING_QUANTITY', 'Quantity');

 

$price_ranges = Array( "Under" . ' ' . $currencies->format('99', DEFAULT_CURRENCY),

$currencies->format('100', DEFAULT_CURRENCY) . ' ' . "to" . ' ' . $currencies->format('349', DEFAULT_CURRENCY),

$currencies->format('350', DEFAULT_CURRENCY) . ' ' . "to" . ' ' . $currencies->format('649', DEFAULT_CURRENCY),

$currencies->format('650', DEFAULT_CURRENCY) . ' ' . "and above" );

 

$price_ranges_sql = Array( "p.products_price < 99",

"(p.products_price <= 100 and p.products_price >= 349)",

"(p.products_price <= 350 and p.products_price >= 649)",

"p.products_price >= 650");

?>

 

of course you will need to change the price values as well as maybe extending your left or right column to about 125 pixels - unless someone can fix the 2nd decimal place prob...

Link to comment
Share on other sites

  • 3 weeks later...

Hi,

 

I must have posted my question yesterday in the wrong thread.... I was wondering if your could help me turn this into a drop down "jump to" menu like Linda's categories search in SEC.

 

Thanks

 

Lee

 

I have added an infobox for shopping by price.  It displays a list of price ranges the shopper can click to give an alternative way to shop.

 

I used it for a gift shop application where the shopper can quickly find a gift in the price range they want to give.

 

It is based on MS1.

Link to comment
Share on other sites

if you want to do a drop down list - replace your boxes/shop_by_price.php with this:

 

 

<!-- shop by price //-->

         <tr>

           <td>

<?php

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOP_BY_PRICE);







   $info_box_contents = array();

   $info_box_contents[] = array('align' => 'left',

                                'text'  => BOX_HEADING_SHOP_BY_PRICE

                               );

   new infoBoxHeading($info_box_contents, false);







   $info_box_contents = array();



$price_range_list = '';

$price_range_list[] = array('id' => '0', 'text' => 'Shop by price' );



       for ($range=0; $range<sizeof($price_ranges); $range++) {

       /*$info_box_contents[] = array('align' => 'left',

                                'text'  => '<a href="' . tep_href_link(FILENAME_SHOP_BY_PRICE, 'range=' . $range , 'NONSSL') . '">' . $price_ranges[$range] . '</a><br>'

                               );*/



$price_range_list[] = array('id' => $range, 'text' => $price_ranges[$range] );

       }$info_box_contents[] = array('form' => '<form action="' . tep_href_link(FILENAME_SHOP_BY_PRICE) . '" method="get">' . tep_hide_session_id(),

                              'align' => 'left',                               'text'  => tep_draw_pull_down_menu('range', $price_range_list, $range, 'onchange="this.form.submit();"')

                             );



   new infoBox($info_box_contents);



?>

           </td>

         </tr>

<!-- shop_by_price //-->

Link to comment
Share on other sites

Many thanks for the quick response! This is great!

 

Would I be wearing out my welcome if I asked for one small favor...? How do you make it a simple form tag that can be included in any table, without the infoBox class style? I've tried all morning but not getting anywhere. Basically, I want to add it in my header table row next to my categories listbox which looks like this:

 

<form name="quick_jump" class="form" method="get" action="<?php echo tep_href_link(FILENAME_DEFAULT, 'jumpto=1', 'NONSSL'); ?>"><?php echo tep_draw_pull_down_menu('cPath', tep_get_categories(array(array('id' => '0', 'text' => 'Select a Category'))) , $current_category_id, 'onChange="this.form.submit();"'); echo '<input type=hidden name=category value=1>';?></form>

 

if you want to do a drop down list - replace your boxes/shop_by_price.php with this:
[/code]
Link to comment
Share on other sites

<?php

$price_range_list = '';

$price_range_list[] = array('id' => '0', 'text' => 'Shop by price' );



       for ($range=0; $range<sizeof($price_ranges); $range++) {

$price_range_list[] = array('id' => $range, 'text' => $price_ranges[$range] );

       }

?>





<form class="form" method="get" action="<?php tep_href_link(FILENAME_SHOP_BY_PRICE); ?>"><?php echo  tep_draw_pull_down_menu('range', $price_range_list, $range, 'onchange="this.form.submit();"'); ?></form>

 

 

try that - I haven't tested it - but it looks ok to me

Link to comment
Share on other sites

Thanks so much for the code! I was having some trouble initially, as only "shop by price" was showing as an option. Then I discovered I needed to add the reference to the language file, so just before the first line, I added this:

 

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOP_BY_PRICE);

 

Works like a charm! Thanks again for your help & responsiveness. :D

 

 

<?php

$price_range_list = '';

$price_range_list[] = array('id' => '0', 'text' => 'Shop by price' );



       for ($range=0; $range<sizeof($price_ranges); $range++) {

$price_range_list[] = array('id' => $range, 'text' => $price_ranges[$range] );

       }

?>





<form class="form" method="get" action="<?php tep_href_link(FILENAME_SHOP_BY_PRICE); ?>"><?php echo  tep_draw_pull_down_menu('range', $price_range_list, $range, 'onchange="this.form.submit();"'); ?></form>

 

 

try that - I haven't tested it - but it looks ok to me

[/code]
Link to comment
Share on other sites

Well, I thought I had this working as a form within my header, but I discovered the action is blank so nothing happens. If I use the modified drop down code in an info box, it works. Here's my code, if anyone can help:

 

$price_range_list = '';

$price_range_list[] = array('id' => '0', 'text' => 'Shop by price' );



for ($range=0; $range<sizeof($price_ranges); $range++) {

$price_range_list[] = array('id' => $range, 'text' => $price_ranges[$range] );

       }

     

<form class="form" method="get" action="<?php tep_href_link(FILENAME_SHOP_BY_PRICE); ?>"><?php echo  tep_draw_pull_down_menu('range', $price_range_list, $range, 'onchange="this.form.submit();"'); ?></form></td>

Link to comment
Share on other sites

  • 1 month later...

I just installed it but just get a blank page when i click on the link... any ideas any one .. I will ready the forum some more maybe i missed something. :lol:

Link to comment
Share on other sites

Are you getting a blank page as no header, side columns, nothing?

 

Or is the shop by price not showing the proper products?

 

Did you configure your shop_by_price.php in /catalog/includes/languages/(your language/shop_by_price.php?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...