Post by Wardy_118 » Tue Oct 11, 2011 9:56 pm

Hi,

I am currently using opencart v1.5.0 for my website. I have set the pricing to only be displayed once a customer has logged in to their account. However, I notice that without being logged in you can still add products to your shopping cart. They just show without the price being displayed in the cart.

I was wondering if it would be possible that if someone is not logged in and they click "Add to cart" that a pop up message would come up on the screen saying "To add products to your shopping cart please login". As well as this pop up the product itself would not be added to the shopping cart like it currently is. So you are only able to see products in the cart once you have logged in.

Can anybody help with this.

Thanks in advance.
Last edited by Wardy_118 on Wed Oct 12, 2011 8:19 pm, edited 1 time in total.

New member

Posts

Joined
Tue Apr 13, 2010 5:50 pm

Post by uksitebuilder » Wed Oct 12, 2011 6:49 pm

OK big edit

for each of the following files
Untitled-1.png

Untitled-1.png (3.41 KiB) Viewed 8949 times

find

Code: Select all

<a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"><span><?php echo $button_cart; ?></span></a>
change to

Code: Select all

<?php if($this->customer->isLogged()){ ?><a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"><span><?php echo $button_cart; ?></span></a><?php }else{ ?><a onclick="alert('Please Login to View Prices and Add to Cart!');" class="button"><span><?php echo $button_cart; ?></span></a><?php } ?>
and also

open: catalog/view/theme/default/template/product/product.tpl

find

Code: Select all

<a id="button-cart" class="button"><span><?php echo $button_cart; ?></span></a>
change to

Code: Select all

<?php if($this->customer->isLogged()){ ?><a id="button-cart" class="button"><span><?php echo $button_cart; ?></span></a><?php }else{ ?><a onclick="alert('Please Login to View Prices and Add to Cart!');" class="button"><span><?php echo $button_cart; ?></span></a><?php } ?>

ImageImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by Wardy_118 » Wed Oct 12, 2011 8:18 pm

Hi Simon,

It is now working great.

Thanks so much for all of your help.

New member

Posts

Joined
Tue Apr 13, 2010 5:50 pm

Post by VAHID » Sun Feb 12, 2012 2:14 am

hi simon
i need this for addition image popup in product page
What do I need to change?
thanks

User avatar
New member

Posts

Joined
Sat Oct 22, 2011 4:55 am

Post by spitos » Fri Mar 30, 2012 9:29 pm

Vqmod here to help anyone out too.

Attachments


Image
Google Analytics Expert - Advanced e-commerce tracking, Product & options reporting, transaction/conversion reporting, Google Adwords conversion & profit reporting, goal & funnel reporting, event tracking, site search tracking, multi-store compatibility, EU Cookie Law compliance and works with any theme or checkout! Easy vqmod install. Get it here


User avatar
Active Member

Posts

Joined
Mon May 23, 2011 6:19 pm
Location - UK

Post by variuxdavid » Tue Apr 24, 2012 7:11 am

I've updated the vqmod for Add To Cart Login Aleart for OpenCart Version 1.5.2.1

I removed the wishlist.tpl, because it seems you can't view a wishlist unless you are logged in anyway.

Enjoy,

Attachments

Add to cart login alert vqmod for OpenCart version 1.5.2.1


Newbie

Posts

Joined
Tue Apr 24, 2012 7:06 am
Location - Marietta, GA

Post by halena » Thu May 10, 2012 10:13 pm

Hi.

If I need this popup message regardless if customer logged in or not ..What do I need to change?

thanks in advance.

Newbie

Posts

Joined
Mon Jan 04, 2010 2:37 am

Post by mojkan » Thu Nov 28, 2013 8:23 pm

Hi!

I know I'm reviving an old thread. However, I have the exact same issue! BUT, finding the lines needed to alter they don't exist.

For instance, if I open a specified file and search for "<a onclick="addToCart" it doesn't exist. Therefore, I'm afraid of editing it since Idon't know if 1.5.6 is different.

Anyone care to give me a nudge in the right direction so that I can apply these changes in version 1.5.6

Thanks!

/H

New member

Posts

Joined
Tue Oct 29, 2013 3:28 am
Who is online

Users browsing this forum: No registered users and 40 guests