Post by comprido » Sat Dec 15, 2018 12:42 pm

Hello everyone, I'm upgrading my Opencart 1.5.6.4 to 3.0.2
A essential mod in use that I develop is "Restrict Shop by Brand" is a basic comparison between Manufacturer IDs on cart and checkout.
URL: https://www.opencart.com/index.php?rout ... n_id=33289

A few lines that I would be glad if someone can adapt as I saw that the code syntax changed as wall as some routes.
Thanks

Pedro Martin - websitesbuilder.com.au
Checkout my free extensions: https://www.opencart.com/index.php?rout ... r=comprido


User avatar
New member

Posts

Joined
Mon Sep 10, 2012 11:46 pm

Post by xxvirusxx » Sat Dec 15, 2018 7:16 pm

On that picture, on cart it show Manufacturer ID.
For that you use another module?

Because you vqmod extension doesn't show manufacturer id also has some bugs like:

Incorect

Code: Select all

<search position="after"><![CDATA[$_[<td class="model"><?php echo $column_model; ?></td>]]></search>
Correct

Code: Select all

<search position="after"><![CDATA[<td class="model"><?php echo $column_model; ?></td>]]></search>
Incorect

Code: Select all

<file name="catalog/controller/checkout/chekout.php">
Correct

Code: Select all

<file name="catalog/controller/checkout/checkout.php">
And you should change from

this

Code: Select all

			<search position="after"><![CDATA[if ($product['minimum'] > $product_total) {
				$this->redirect($this->url->link('checkout/cart'));
			}]]></search>
to this:

Code: Select all

<search position="before"><![CDATA[if ($product['image']) {]]></search>

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by Johnathan » Sat Dec 15, 2018 11:55 pm

Restrict Checkout can do the actual restrictions, though it won't add the "Manufacturer" column to the cart page. You could either hire someone to do that separately, or match the Model of the product to its Manufacturer (since the Model DOES show on the cart page, that would let you show it without requiring any core file edits). Not sure if that's possible for your products, but it's an easy way around changing internal stuff.

Feel free to take a look at the screenshots and demo site, and if you're interested let me know at www.getclearthinking.com/contact if you have any further questions.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by comprido » Sun Dec 16, 2018 5:42 am

Johnathan wrote:
Sat Dec 15, 2018 11:55 pm
Restrict Checkout can do the actual restrictions
Cool Johnathan, yeah thanks for the corrections I have to reupload.
You can see the module in action on tee-shirt.com.au if you add to products from different categories, but not cat_0 wich I allow to combine with the rest.
So, as you know not to just show the manufacturer ID but more important, disable customers to buy from different manufacturers.
I think it is quite simple mod to adapt to OC3 if you understand the syntaxis maybe you could help me. I will go through that today.

Pedro Martin - websitesbuilder.com.au
Checkout my free extensions: https://www.opencart.com/index.php?rout ... r=comprido


User avatar
New member

Posts

Joined
Mon Sep 10, 2012 11:46 pm

Post by xxvirusxx » Sun Dec 16, 2018 6:10 am

See if is ok (updated file)

LE. You forgot to change this on you version

Code: Select all

<search position="after"><![CDATA[$_[<td class="model"><?php echo $product['model']; ?></td>]]></search>
to

Code: Select all

<search position="after"><![CDATA[<td class="model"><?php echo $product['model']; ?></td>]]></search>

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by comprido » Sun Dec 16, 2018 8:44 am

Works perfectly, thanks mate.
Attached code I use for the exception. Feel free to add to your free converted extensions!

Attachments

Restricted Shop by Manufacturer except Manufacturer ID "0"


Pedro Martin - websitesbuilder.com.au
Checkout my free extensions: https://www.opencart.com/index.php?rout ... r=comprido


User avatar
New member

Posts

Joined
Mon Sep 10, 2012 11:46 pm

Post by comprido » Sun Dec 16, 2018 9:07 am

xxvirusxx wrote:
Sun Dec 16, 2018 6:10 am
See if is ok (updated file)
Would it be easy to add a feature to show an alert on top of each product or once they add again another - just to remind the user once they have already a product from a different manufacturer on their cart? Thanks in advance.

PD. So I guess controller/checkout/cart.php and controller/common/cart.php in function index() - IF the visited/added product manufacturer != manufacturer/s from product/s already on cart THEN SHOW the ALERT.

Attachments

Screenshot_4.png

Alert if product on cart from different manufacturer - Screenshot_4.png (307.37 KiB) Viewed 933 times


Pedro Martin - websitesbuilder.com.au
Checkout my free extensions: https://www.opencart.com/index.php?rout ... r=comprido


User avatar
New member

Posts

Joined
Mon Sep 10, 2012 11:46 pm

Post by comprido » Sun Dec 16, 2018 9:58 am

I actually discovered a bug on my code, if you add the product with manufacturer_id=0 the last, it doesn't check further. So how can I add the conditional IF THERE ARE MORE THAN 3 manufacturer_ids or check all the manufacturer_ids against the others?

Pedro Martin - websitesbuilder.com.au
Checkout my free extensions: https://www.opencart.com/index.php?rout ... r=comprido


User avatar
New member

Posts

Joined
Mon Sep 10, 2012 11:46 pm
Who is online

Users browsing this forum: trixiemay and 199 guests