Post by comprido » Thu Jan 17, 2019 11:02 am

I've tried in module/cart.php after foreach ($this->cart->getProducts() as $product) { :

Code: Select all

		
			
			/* Manufacturer Mod */
			$product_total = 0;
			foreach ($this->cart->getProducts() as $product_2) {
			$product_total = 0;
	
			if ($product_2['manufacturer_id'] != $product['manufacturer_id'] && $this->request->get['route'] != 'checkout/cart') {						
				if (($product_2['manufacturer_id'] != 0) && ($product['manufacturer_id'] != 0))  {
				//$this->redirect($this->url->link('checkout/cart'));				
				 $json['error']['manufacturer'] = $this->language->get('error_manufacturer');
					 } elseif (isset($product['manufacturer_id']) || isset($product_2['manufacturer_id'])) {		 } 
				}	
			}
			/* Manufacturer Mod */
			
Then in catalog/view/javascript/common.js before if (json['success']) {

Code: Select all

if (json['error']['manufacturer']) {
 		   $('#notification').html('<div class="error" style="display: none;">' + json['error']['manufacturer'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
				
				$('.error').fadeIn('slow');
}
and it doesn't print the warning as expected... any suggestion?

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 straightlight » Thu Jan 17, 2019 6:58 pm

Since you're using a module, you may want to use the $this->data['error_manufacturer_exceeded'] instead of $json['error']['manufacturer'] and the JS file may not be of much help in this case since you need to add the error message in your module TPL file.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 14 guests