Post by JD2 » Wed Jul 15, 2020 5:43 pm

Hi! On the cart and wishlist pages I'd like to change model with JAN. How would I go about doing that?
I already tried adding

Code: Select all

'jan'        => $result['jan']
under

Code: Select all

$data['products'][] = array(
in the wishlist.php controller, but that didn't work. I think I need to add something else ;-) Could someone help me with this?

I'm using Opencart 3.0.3.2
Last edited by JD2 on Thu Jul 16, 2020 2:07 pm, edited 1 time in total.

JD2
New member

Posts

Joined
Thu Jun 11, 2020 7:42 pm

Post by Wid » Wed Jul 15, 2020 5:59 pm

Can you provide us with some more details?
What exactly do you want to do?

take a visit to My Modules !


Wid
New member

Posts

Joined
Fri Feb 02, 2018 9:19 pm
Location - Athens/Greece

Post by JD2 » Wed Jul 15, 2020 6:05 pm

Hi! I'd like to change replace this 'Model' with 'JAN':
Image
I'd like to do this both on the cart and the wishlist page.

JD2
New member

Posts

Joined
Thu Jun 11, 2020 7:42 pm

Post by letxobnav » Wed Jul 15, 2020 8:26 pm

check your oc error log.

in the wishlist controller it is

Code: Select all

'jan'      => $product_info['jan'],
in the cart controller it is

Code: Select all

'jan'     => $product['jan'],
then adjust your views accordingly.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by JD2 » Wed Jul 15, 2020 9:23 pm

Hi! That worked for the wishlist, but not for the cart. This is how it looks in cart.php (both in common/ and checkout/):

Code: Select all

$data['products'][] = array(
					'cart_id'   => $product['cart_id'],
					'thumb'     => $image,
					'name'      => $product['name'],
					'model'     => $product['model'],
					'option'    => $option_data,
					'recurring' => $recurring,
					'quantity'  => $product['quantity'],
					'stock'     => $product['stock'] ? true : !(!$this->config->get('config_stock_checkout') || $this->config->get('config_stock_warning')),
					'reward'    => ($product['reward'] ? sprintf($this->language->get('text_points'), $product['reward']) : ''),
					'price'     => $price,
					'total'     => $total,
					'href'      => $this->url->link('product/product', 'product_id=' . $product['product_id']),
					'jan'       => $product['jan']
				);
			}
For adding it to the cart.twig file I tired both {{ product.jan }} and {{ jan }} but those don't work. Other changes made to the twig file do appear.

No errors show up in the logs, and the changes are visible in the modification directory.
Am I doing something wrong?

JD2
New member

Posts

Joined
Thu Jun 11, 2020 7:42 pm

Post by netruxa » Thu Jul 16, 2020 3:54 am

are you refresh modifications cache?

User avatar
New member

Posts

Joined
Fri Dec 16, 2016 1:34 pm


Post by sw!tch » Thu Jul 16, 2020 4:26 am

JD2 wrote:
Wed Jul 15, 2020 9:23 pm
Hi! That worked for the wishlist, but not for the cart. This is how it looks in cart.php (both in common/ and checkout/):
Am I doing something wrong?
In checkout/cart the products array is fed from the cart class not the product model.

Keep the code you have, but in system/library/cart/cart.php you also need to add:

Code: Select all

'jan'             => $product_query->row['jan']
You can reference the line and array below.
https://github.com/opencart/opencart/bl ... t.php#L238

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm
Location - USA

Post by JD2 » Thu Jul 16, 2020 2:07 pm

Hi! That worked, thanks! I had double check because I could add it on different places in the file, but it works now.

JD2
New member

Posts

Joined
Thu Jun 11, 2020 7:42 pm
Who is online

Users browsing this forum: No registered users and 19 guests