Post by jomachi » Wed Jun 22, 2011 4:26 pm

Hi,

I'm OpenCart's newbie but i haven't find any options to limit the number of products to compare.
Customers can choose more than five products, but the comparison table show only five. So, we must limit the number of choice (fewer products to choose is to buy faster!).

So how to limit the number of products to compare.

Thanks for your help.

OpenCart 1.5.1 / Install on VPS Hosting


Newbie

Posts

Joined
Wed Jun 22, 2011 3:23 pm

Post by Axertion » Thu Jun 23, 2011 1:32 am

There is no option, but I figured out where the limit is defined.

Open
catalog/controller/product/compare.php

Find the following on line 182

Code: Select all

if (count($this->session->data['compare']) > 4) {
Where the number 4 is displayed, change this to your limit - 1

Example:
to limit to 2, you will need to put 1
to limit to 3, you will need to put 2
to limit to 4, you will need to put 3
etc...

Newbie

Posts

Joined
Thu Jun 23, 2011 12:48 am

Post by jomachi » Fri Jun 24, 2011 6:50 pm

Yes, thanks

I have seen this, but when users add more product to compare, no error message show him he has exceeded the limit.
This would be a suggestion to OpenCart programmers team.

OpenCart 1.5.1 / Install on VPS Hosting


Newbie

Posts

Joined
Wed Jun 22, 2011 3:23 pm

Post by Arif Shaik » Tue Jul 03, 2012 2:31 pm

Thanks a lot for your help it works.. :ok:
"Knowing is not doing, Doing is Doing"

Newbie

Posts

Joined
Tue Jul 03, 2012 2:26 pm

Post by MikeSCC » Fri Jan 11, 2013 10:52 pm

Thanks for this, it's very helpful.

Is it possible to display an error message when more than 4 products are added to compare?

Thanks,

Mike

Active Member

Posts

Joined
Tue Nov 20, 2012 5:55 pm

Post by wsmolak » Thu Jan 17, 2013 5:14 am

You can use session variable with table of products to compare.

If quantity of products being compared if above your value don't display compare button:

Code: Select all

<?php if (count($this->session->data['compare']) < 3) { ?>
          <a onclick="addToCompare('<?php echo $product_id; ?>');"><?php echo $button_compare; ?></a>
<?php } ?>

Newbie

Posts

Joined
Thu Jan 17, 2013 5:05 am
Who is online

Users browsing this forum: No registered users and 50 guests