Search code examples
phpxmlopencartvqmod

Opencart Extension - Hide Price Until Login - Recode


New to the world Opencart!

I have just installed version 1.5.6.4 and have tried to install an extension in the vQmod folder. It is also worth mentioning that I have tinkered with my own theme (which works) it's called 'mytheme'. In addition, I noticed that the extension that I downloaded was made for older versions. For your reference I have attached a link to the extension.

http://www.opencart.com/index.php?route=extension/extension/info&extension_id=6136&filter_search=hide%20price&page=2

This extension is spot on for what we need... is there a way to update this in the code to make it work for our needs? I have also (after trial and error and getting nothing) updated a line of code in the file. This is assuming of course that I haven't missed something along the way.

<file name="catalog/view/theme/mytheme/template/module/bestseller.tpl">
        <operation>
            <search position="replace"><![CDATA[
            onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" />
             ]]></search>
             <add><![CDATA[
             <?php if($this->customer->isLogged()){ ?>onclick="addToCart('<?php echo         $product['product_id']; ?>');" class="button" /><?php }else{ ?>onclick="alert('Please Login to View      Prices and Add to Cart!');" class="button" /><?php } ?>
            ]]></add>
        </operation>
</file>

Any relevant help or pointers would be appreciated.


Solution

  • I don't know why you are using extension for hiding price when there is default feature to do this.

    If you don't know login to

    admin>system>setting>option
    

    Under the Account heading There is a option Login Display Prices: enable it

    Addedenter image description here