Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

This following module is based on this Addon.

http://addons.oscommerce.com/info/9006

This is for osC 2.3.4 BS GOLD and/or EDGE version.
It will give you the possibility to "narrow down" the products listed in the product_listing.php page.
To setup filters I think you better install the sample filters and look how they are setup.

Please backup your files and database before attempting to install this.
There are unfortunately file changes necessary but really minor ones.

FULL PACKAGE: Filter Module BS.zip

Enjoy!
 

Link to comment
Share on other sites

  • 1 month later...
  • Replies 70
  • Created
  • Last Reply

Hi, Can we ajax refresh the product listing using the filter rather than getting the whole page to load again?

 

Can? Probably yes.

How? I have no idea.

Believe me If I knew how the Ajax stuff works it would have been already inside it.

Maybe someone with such skills could look into it once.

Link to comment
Share on other sites

  • 3 weeks later...

@@radhavallabh
 
Hi!
I was thinking about that AJAX thing and I thought since I am not able to do that why not just use the jquery onclick="this.form.submit()"
This will reload the page after every checkbox click. So you don't have to click the update button anymore.
 
If you want to try this once follow the instructions below.
 
Open your catalog/includes/modules/content/products_filter/cm_products_filter.php file.
 
FIND

$products_filter_content .= tep_draw_checkbox_field('cfil' . $products_options_name['categories_filters_id'] . '[' . $row . ']', (int)$products_options['categories_filters_values_id'], (isset($_GET['cfil' . $products_options_name['categories_filters_id']]) ? (is_array($_GET['cfil' . $products_options_name['categories_filters_id']]) ? (in_array($products_options['categories_filters_values_id'], $_GET['cfil' . $products_options_name['categories_filters_id']]) ? true : false) : false) : false )) . ' ' . $products_options['categories_filters_values_name'] . '<br />'; 

REPLACE WITH

// BACKUP ORIGINAL CODE
//$products_filter_content .= tep_draw_checkbox_field('cfil' . $products_options_name['categories_filters_id'] . '[' . $row . ']', (int)$products_options['categories_filters_values_id'], (isset($_GET['cfil' . $products_options_name['categories_filters_id']]) ? (is_array($_GET['cfil' . $products_options_name['categories_filters_id']]) ? (in_array($products_options['categories_filters_values_id'], $_GET['cfil' . $products_options_name['categories_filters_id']]) ? true : false) : false) : false )) . ' ' . $products_options['categories_filters_values_name'] . '<br />'; 
$products_filter_content .= tep_draw_checkbox_field('cfil' . $products_options_name['categories_filters_id'] . '[' . $row . ']', (int)$products_options['categories_filters_values_id'], (isset($_GET['cfil' . $products_options_name['categories_filters_id']]) ? (is_array($_GET['cfil' . $products_options_name['categories_filters_id']]) ? (in_array($products_options['categories_filters_values_id'], $_GET['cfil' . $products_options_name['categories_filters_id']]) ? true : false) : false) : false ), 'onclick="this.form.submit()"') . ' ' . $products_options['categories_filters_values_name'] . '<br />';

FIND

$products_filter_content .= '<div class="buttonSet">
	 	        <span class="buttonAction">' . tep_draw_button(IMAGE_BUTTON_UPDATE, 'fa fa-refresh', null, 'primary'); 

REPLACE WITH

/* BACKUP ORIGINAL CODE
$products_filter_content .= '<div class="buttonSet">
			<span class="buttonAction">' . tep_draw_button(IMAGE_BUTTON_UPDATE, 'fa fa-refresh', null, 'primary'); 
*/
$products_filter_content .= '<div class="buttonSet"><span class="buttonAction">'; 

That's it.

Like I said not AJAX but it still makes filtering lot more comfortable.

Link to comment
Share on other sites

Hi @@Tsimi,

Yes this is a great and seems a very good option ....have got it working this way but still requires page refresh like regular submit ,
When it only refresh the Div -That is where the ajax gets complicated .. Here I am not able to fix on how can we use XHR with ajax to get this working??

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...

@@Tsimi

Hi,

I am a newbie at instructions but have tried to give them at my best! :)

Here is what can activate ajax on a filter addon-

 

1.On the js file of the filter addon......Add below in the function which triggers the form to display results-

  $("#xxxxxx input[type=checkbox]").change(function(e) {
 e.preventDefault();
 $.get('http://www.xxxxxxxx.com/ajax_index.php', $("#form id").serialize(), function(data){
                $('#name of div where it will show').html(data);
          })
});

2.Then download the ajax-index.php from

http://addons.oscommerce.com/info/9455 --- Do not install the addon in any case (as told to me).

 

3.Upload it to catalog folder and edit it the lines as per your modified store ( do not include the template top or template bottom files anywhere)

Comment out all the lines that refer to the image loader.gif

Replace the display divs #name with the one you have already.

 

4.This should activate the ajax!

 

Link to comment
Share on other sites

Hi guys,

 

Just to let you know, since your "Products Filter" is a bootstrap version, then the "Ajax Product Listing" module can be installed on a BS store, since it was designed for the bootstrap version of osC. It would make it easier instead of trying to hash code again. You would still require the script mentioned above though for the filter add-on functions to work, since this is not included in the Ajax module. What it would allow is the std filter, sort and page links to load via ajax also.

 

It wasn't installed on @@radhavallabh's store because it wasn't compatible with his non-BS store. So we had to pull bits of code out of the module to get it to work on the filter add-on, and also got it to work on the sort and page links.

 

The "Ajax Product Listing" module does rely on the BS store not having core changes that could prevent it from working, mainly in the way it pin points certain elements, id's, classes and links, then finds the target container to load the ajax content, otherwise all functions should work correctly.

 

Just thought I'd give you this info, but it's up to you though.

 

cheers

 

 

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

@@radhavallabh

@@auzStar

 

Sorry if this is some sort of repetition for you guys but right now I don't understand how to implement this.

I have a osC BS test store with the Ajax addon and Filter addon installed.

 

 

On the js file of the filter addon......Add below in the function which triggers the form to display results-

As far I know there is no js file for the filter.

 

You guys cut out bits and pieces from the Ajax addon to make it work on a non-BS shop. And you guys put something together or changed files from either addon to make it work. That is the part I need to see. Maybe changed something inside the ajax_index.php ??

How does the includes/functions/filter.php looks like now?

Link to comment
Share on other sites

@@Tsimi

 

I've had a quick look at this module's code (not seen this version in operation) and I can see that @radhavallabh's add-on filter has been customised (or is a different module) and nothing seems to match up.

 

From what I can see you'll need to put some js code inside the cm_products_filter.php module file (to add to footer scripts), similar to my ht_ajax_product_listing.php module, using the code under case: 'index.php' section as an example (that's if your module only works for index page, not sure, if it works on all pages where product listing appears then you will have to include all sections). Basically, with the js code you'll have to capture the update and clear button events and then load a page into the target div container, via ajax, that processes the data with the filter parameters being passed to it. And because pages that load via ajax don't recognise scripts that are already sitting in footer, you'll need to include similar js script that you write above at the bottom of that ajax processing page. Look at my files as a guide.

 

Hope you understand all this, little bit complicated I know, but it can be done. I'll try to help when I can.

 

PS. I'll be posting an update to the "Ajax Product Listing" module shortly with some slight changes, mainly just cleaner code and making sure the module only loads for products when on the index page. So you might want to wait for it.

 

cheers

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

FYI

 

New version of "Ajax Product Listing" (v1.1) has been uploaded:

http://addons.oscomm...9455/#tabs-hist

 

cheers

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

  • 1 month later...

@@Tsimi

 

Don't know how you got on with this. Sorry for late response, but due to other commitments I'm not getting to spend much time on coding at the moment.

 

But I've attached a sample working copy of your "products filter" module, ajax version. It includes ajax javascript code similar to latest "ajax product listing".

 

At the moment it works with the update and clear buttons (on your original module without the onclick() modification you suggested in an earlier post). If you want the checkboxes to work onclick() just remove these "//" from the section under "// checkboxes", and then remove the update button if you prefer.

 

I haven't modified your original code except for the addition of one global variable and the inclusion of the javascript code which is plugged into footer scripts, 

 

I've tested this in a local BS copy only.

 

At least it's a start on this and may require some fine tuning.

 

You'll need to have "images/ajax-loader.gif", either from the "ajax product listing" package or your own.

 

cheers

cm_products_filter.php

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

@@auzStar

 

Thank you for not forgetting Dom! :thumbsup:

I was/am busy myself at the moment but I look forward to install your file and take a look at it asap.

I will report back as soon I can.

 

Again, thank you.

 

Lambros

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
  • 2 weeks later...

Hi @@Tsimi

 

Ok, I have installed it to my testshop, changed the language ids from the demo.sql to 2 (german) an run a test. Looks great till i try to add another filter...

Have added "Format" to the Categories Filter in step 1 -> everything fine :) Then I tried to add "16:9" as Filter value, but it appears twice. If I try to delete

one of them, I get

 



1054 - Unknown column 'c.categories_id' in 'field list'

select c.categories_id, cd.categories_name, cf.categories_filters_name from categories C, categories_filters_attributes cfa, categories_filters cf, categories_description cd where cd.categories_id = c.categories_id and cd.language_id = '2' and cf.language_id = '2' and cfa.categories_id = c.categories_id and cfa.categories_filters_values_id='8' and cf.categories_filters_id = cfa.categories_filters_id order by cd.categories_name

 

Maybe I have installed something wrong. My Kids were at the door a thousand times. I will try again tonight ;)

 

SEE YA

Denzel. 

Link to comment
Share on other sites

Uppercase spelled query in admin/categories_filters.php

 

change line 848 to 

    $categories = tep_db_query("select c.categories_id, cd.categories_name, cf.categories_filters_name from " . TABLE_CATEGORIES . " c, categories_filters_attributes cfa, categories_filters cf, " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.categories_id = c.categories_id and cd.language_id = '" . (int)$languages_id . "' and cf.language_id = '" . (int)$languages_id . "' and cfa.categories_id = c.categories_id and cfa.categories_filters_values_id='" . (int)$HTTP_GET_VARS['value_id'] . "' and cf.categories_filters_id = cfa.categories_filters_id order by cd.categories_name");

SEE YA

Denzel.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...