Post by bcfl » Fri Jun 11, 2010 8:11 am

Just updated to 1.4.8 on my test box, if I check System Settings, Login Display prices = yes (like I do)
The prices disappear on the home page, (as they should) but the little + signs stay, If I click the +(Add to Cart)
the customer is taken to the cart screen and the prices are displayed.

Can we get the + sign removed along with the price if the customer is not logged in??

Thanks, and Great Work!
bob
Last edited by i2Paq on Fri Jun 11, 2010 2:38 pm, edited 1 time in total.
Reason: Split from 1.4.8 Bug topic + title change + moved

New member

Posts

Joined
Tue Jan 26, 2010 5:34 am

Post by Qphoria » Fri Jun 11, 2010 8:13 am

its not a + sign.. its the add to cart button.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by bcfl » Fri Jun 11, 2010 8:18 am

OK My error but same question, can we remove the add to cart button if the user is not logged in?
Thank You

New member

Posts

Joined
Tue Jan 26, 2010 5:34 am

Post by Qphoria » Fri Jun 11, 2010 8:28 am

Sure

1. EDIT:
catalog/view/theme/default/template/module/latest_home.tpl
catalog/view/theme/default/template/module/featured_home.tpl
catalog/view/theme/default/template/module/special_home.tpl
catalog/view/theme/default/template/module/bestseller_home.tpl
catalog/view/theme/default/template/product/special.tpl
catalog/view/theme/default/template/product/category.tpl
catalog/view/theme/default/template/product/manufacturer.tpl
catalog/view/theme/default/template/product/search.tpl
catalog/view/theme/default/template/product/product.tpl


2. IN ALL FILES CHANGE:

Code: Select all

<?php } ?>
<?php } ?>
<a class="button_add_small" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" >&nbsp;</a>
3. TO:

Code: Select all

<?php } ?>
<a class="button_add_small" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" >&nbsp;</a>
<?php } ?>

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by bcfl » Fri Jun 11, 2010 8:44 am

Works like a charm, Thank YOU

New member

Posts

Joined
Tue Jan 26, 2010 5:34 am

Post by felizone » Thu Jun 24, 2010 6:08 pm

Qphoria wrote:Sure

1. EDIT:
catalog/view/theme/default/template/module/latest_home.tpl
catalog/view/theme/default/template/module/featured_home.tpl
catalog/view/theme/default/template/module/special_home.tpl
catalog/view/theme/default/template/module/bestseller_home.tpl
catalog/view/theme/default/template/product/special.tpl
catalog/view/theme/default/template/product/category.tpl
catalog/view/theme/default/template/product/manufacturer.tpl
catalog/view/theme/default/template/product/search.tpl

2. IN ALL FILES CHANGE:

Code: Select all

<?php } ?>
<?php } ?>
<a class="button_add_small" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" >&nbsp;</a>
3. TO:

Code: Select all

<?php } ?>
<a class="button_add_small" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" >&nbsp;</a>
<?php } ?>
After i did, i still can see the small cross icon in the related product section.
MAy i know which file can i edit it?
Thanks

New member

Posts

Joined
Thu Apr 08, 2010 3:28 pm

Post by felizone » Thu Jun 24, 2010 6:15 pm

My fault , sorry.
It works perfectly

Thank you guys. O0

New member

Posts

Joined
Thu Apr 08, 2010 3:28 pm

Post by krollster » Sun Aug 22, 2010 4:22 am

Hi,

I've just come across this in the 1.4.8b install, and moving the add to cart button obviously fixes the
problem of stopping people from adding things to the cart and seeing prices when 'display prices to logged in users only' is set however. The actual cart controller and template do not seem to check for this setting at all.

What this means is that people that know open cart, or have ever seen an openCart site can easily modify the url
and find out pricing that is supposed to be hidden from them if they're not logged in.

If you're not logged in and prices are set to be hidden from guest users, simply going to

http://<my_site>/index.php?route=checkout/cart&product_id=30
http://<my_site>/index.php?route=checkout/cart&product_id=42
etc ...

or another product ID will add an item to the cart and show you the item pricing and total on the cart page.
To fix this issue for my current project I've added taken the following code from the category controller:

Code: Select all

if (!$this->config->get('config_customer_price')) {
	$this->data['display_price'] = TRUE;
} elseif ($this->customer->isLogged()) {
	$this->data['display_price'] = TRUE;
} else {
	$this->data['display_price'] = FALSE;
}
I added that code to the very beginning of the index() method and wrapped a conditional around $_GET and $_POST incoming product check like so :

Code: Select all

if ( $this->data['display_price'] )
{
    if ($this->request->server['REQUEST_METHOD'] == 'GET' && isset($this->request->get['product_id'])) {
    
        ...
        
    } elseif ($this->request->server['REQUEST_METHOD'] == 'POST') {
    
        ...
    }
} // END 'display price' fix
It is pretty plain, but I think if you're locking your store down to registered users only (like in my case) and want to hide pricing from everyone else, the cart really shouldn't be handling any incoming product actions either.

In addition to that I've wrapped the form on the cart.tpl in a conditional too:

Code: Select all

<?php if ($display_price) { ?>
    <form action="<?php echo str_replace('&', '&', $action); ?>" method="post" enctype="multipart/form-data" id="cart">
      ...
   </form>
<?php } ?>
So the fix is quite simple (in my case) I'm sure the check for the display price setting will be added to the cart and other areas of openCart in future versions. If it has been fixed in a patch already, I do apologise for the double post.

If not maybe this will help someone else out there in the meantime.

Newbie

Posts

Joined
Sun Aug 22, 2010 3:58 am

Post by Qphoria » Sun Aug 22, 2010 11:30 pm

krollster wrote: What this means is that people that know open cart, or have ever seen an openCart site can easily modify the url
and find out pricing that is supposed to be hidden from them if they're not logged in.

If you're not logged in and prices are set to be hidden from guest users, simply going to

http://<my_site>/index.php?route=checkout/cart&product_id=30
http://<my_site>/index.php?route=checkout/cart&product_id=42
etc ...
Good find!. fixed in 1.4.9 RC2

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by robster » Wed Oct 13, 2010 7:29 pm

@krollster

I have done the fix originally described in this post but I agree with your observations about adding items to cart if you know your way around an OpenCart site.

However I am not sure which file or files I should make your suggested changes to - can you give more information please?

Thank you

robster

I know my place...!


User avatar
Active Member

Posts

Joined
Tue Jul 13, 2010 8:08 pm
Location - North Yorkshire, UK

Post by robster » Tue Nov 02, 2010 7:28 pm

OK so I have removed every + sign so that they don't show when not logged in. However when the customer logs in they are ALL there again. Now I am sure that this is how the script is meant to function, however the annoying thing is that adding items to cart using the + sign works completely differently to adding items to cart using the 'add to cart' button.

Clicking the + sign adds items to the cart and shows the cart page (very slow method for shopping), whilst clicking the 'add to cart' button uses the nice ajax feature but remains on the same page. Why offer two add to cart methods that do different things??

How do I either, a) remove all + signs EVEN when logged in OR, b) get them to add the items to cart the same ajax way.

Sorry about the perhaps longwinded way of explaining but hopefully somebody will have the solution.

Cheers

Rob

I know my place...!


User avatar
Active Member

Posts

Joined
Tue Jul 13, 2010 8:08 pm
Location - North Yorkshire, UK

Post by robster » Tue Nov 02, 2010 9:09 pm

Also I notice that despite the fix posted here for not showing the + sign when not logged in - they still show when viewing 'related products'. Can somebody show me where to remove these + signs please also.

Q, did you update 1.4.9.2 to fix krollster's points?

Cheers

robster

I know my place...!


User avatar
Active Member

Posts

Joined
Tue Jul 13, 2010 8:08 pm
Location - North Yorkshire, UK

Post by Qphoria » Tue Nov 02, 2010 9:36 pm

robster wrote: Q, did you update 1.4.9.2 to fix krollster's points?

Qphoria wrote:Good find!. fixed in 1.4.9 RC2
But i may have missed the related products.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by robster » Tue Nov 02, 2010 9:46 pm

Hi Q

I didn't see this listed in features of 1.4.9.2 patch hence reason for asking.

Yeah I missed them too until now - where would I look to remove them please?

robster

I know my place...!


User avatar
Active Member

Posts

Joined
Tue Jul 13, 2010 8:08 pm
Location - North Yorkshire, UK

Post by Qphoria » Tue Nov 02, 2010 10:11 pm

robster wrote:Hi Q

I didn't see this listed in features of 1.4.9.2 patch hence reason for asking.

Yeah I missed them too until now - where would I look to remove them please?

robster
That is because it was fixed in 1.4.9.0

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Qphoria » Tue Nov 02, 2010 10:13 pm

Qphoria wrote: But i may have missed the related products.
I just took a look and no i didn't miss it in related products. It should be fixed everywhere as of 1.4.9.0 Final

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by robster » Tue Nov 02, 2010 10:39 pm

Hmm weird as I am using fresh install of 1.4.9.1 just installed today and they are there.....

Any way I would still be grateful if you could tell me which file i edit to remove them - everywhere else is indeed fine.

robster

I know my place...!


User avatar
Active Member

Posts

Joined
Tue Jul 13, 2010 8:08 pm
Location - North Yorkshire, UK

Post by robster » Wed Nov 03, 2010 7:29 pm

So is it a secret then Q?

I know my place...!


User avatar
Active Member

Posts

Joined
Tue Jul 13, 2010 8:08 pm
Location - North Yorkshire, UK

Post by Qphoria » Thu Nov 04, 2010 10:26 pm

I assume you are just using a 1.4.8 theme as that is where this was fixed.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by robster » Thu Nov 04, 2010 10:48 pm

in my particular case - yep

I know my place...!


User avatar
Active Member

Posts

Joined
Tue Jul 13, 2010 8:08 pm
Location - North Yorkshire, UK
Who is online

Users browsing this forum: No registered users and 34 guests