Post by amirsam_1 » Fri Oct 23, 2015 1:07 am

Hello all,

I need to check if product was added to wishlist, add some css to wishlist button in product.tpl page..
Need your help please..


Regards

Newbie

Posts

Joined
Fri Oct 23, 2015 1:04 am

Post by grgr » Sun Oct 25, 2015 4:52 pm

Add this:

Code: Select all

		if ($this->customer->getId()) {
			$this->load->model('account/customer');
			$customer_info = $this->model_account_customer->getCustomer($this->customer->getId());
			$wishlist = unserialize($customer_info['wishlist']);
			if (in_array($product_id, $wishlist)) {
				$this->data['in_wishlist'] = true;
			}
		}
Just above:

Code: Select all

$product_info = $this->model_catalog_product->getProduct($product_id);
inside the ../catalog/controller/product/product.php

You can then use $in_wishlist as a test inside the template.

Should work. Obviously, this will only work for logged in users.

-
Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by amirsam_1 » Tue Nov 03, 2015 11:10 pm

grgr wrote: Should work. Obviously, this will only work for logged in users.
Thanks Its worked.

Newbie

Posts

Joined
Fri Oct 23, 2015 1:04 am
Who is online

Users browsing this forum: No registered users and 16 guests