Post by ymcewen » Sat Mar 29, 2014 11:58 am

Hello All...

I am going crazy!!!

Basically I want only my quantity option to have a total price and I am trying to do something like:

Code: Select all

$this->data['options'] = array();
			
			foreach ($this->model_catalog_product->getProductOptions($this->request->get['product_id']) as $option) { 
				if ($option['type'] == 'select' && $option['name'] != 'Quantity' || $option['type'] == 'radio' || $option['type'] == 'checkbox' || $option['type'] == 'image') { 	
					$option_value_data = array();
					
					foreach ($option['option_value'] as $option_value) {
						if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) {
							if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) {
								$price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
							} else {
								$price = false;
							}
							
							
							$option_value_data[] = array(
								'product_option_value_id' => $option_value['product_option_value_id'],
								'option_value_id'         => $option_value['option_value_id'],
								'name'                    => $option_value['name'],
								'image'                   => $this->model_tool_image->resize($option_value['image'], 50, 50),
								'price'                   => $price,
								'price_prefix'            => $option_value['price_prefix']
							);
						}
				if ($option['type'] == 'select' && $option['name'] == 'Quantity') { 	
					$option_value_data = array();
					
					foreach ($option['option_value'] as $option_value) {
						if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) {
							if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) {
								$price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
							} else {
								$price = false;
							}
							
							
							$option_value_data[] = array(
								'product_option_value_id' => $option_value['product_option_value_id'],
								'option_value_id'         => $option_value['option_value_id'],
								'name'                    => $option_value['name'],
								'image'                   => $this->model_tool_image->resize($option_value['image'], 50, 50),
								'price'                         => $this->data['price'] ? $this->currency->format($this->tax->calculate($product_info['special'] ? $option_value['price'] + $product_info['special'] : $option_value['price'] + $product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))) : false,
								'price_prefix'            => $option_value['price_prefix']
							);

					}
But it doesn't seem to work. It kills my product page.
The issus is, I have multiple options and I don't want any apart from quantity to show total price...

Please Help!!!

Newbie

Posts

Joined
Mon May 20, 2013 6:16 am

Post by mcfc4heatons » Tue Jan 24, 2023 1:20 am

hello - is there a solution for opencart 3x - codebase looks a little different to the examples/solution in this thread?

Thanks

New member

Posts

Joined
Sun Jan 22, 2023 8:13 pm
Who is online

Users browsing this forum: Amazon [Bot], Google [Bot], jp1077 and 75 guests