Post by okli » Mon Jul 08, 2019 4:46 pm

Hi All,
Can someone help me to find a solution.

When the user is not registered and login.
Must see only products, no to show the price in product and category and cart button to hide.

When the user is login.
Can see everything normally, product prices and cart button.

Only registered and lodged users to see price and can make an order!

Do you know someone extension to make this? I try to find it but nothing.
Open Cart version is 2.3.0.2

Newbie

Posts

Joined
Thu Mar 31, 2016 9:34 pm

Post by cyclops12 » Mon Jul 08, 2019 5:07 pm

Isn't there a setting in admin to not show prices if not logged in ?

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by OSWorX » Mon Jul 08, 2019 5:27 pm

cyclops12 wrote:
Mon Jul 08, 2019 5:07 pm
Isn't there a setting in admin to not show prices if not logged in ?
Correct: Menu Settings > Tab Options >> Section Account : Show prices only to logged in (or like this in english)

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by okli » Mon Jul 08, 2019 5:53 pm

Yes, I found it. Thank you

I found a solution for the cart button, works great for me but can't make it in ocmod.

I Add this code manually in the header.tpl file.

Code: Select all

<?php if($logged) {  ?>
...my shopping cart code
<?php } ?>
And Works fine.

I Add this code with ocmod file, but not working, any ideas about how to debug code?

Code: Select all

<modification>

    <file path="catalog/view/theme/{so-mobile,so-revo}/template/header/header1.tpl">
        <operation error="skip">
            <search><![CDATA[<div class="block-cart">
                                <div class="shopping_cart">
                                    <?php echo $cart; ?>
                                </div>
                            </div>]]></search>
            <add position="before"><![CDATA[<?php if($logged) {  ?>]]></add>
        </operation>
    </file>

    <file path="catalog/view/theme/{so-mobile,so-revo}/template/header/header1.tpl">
        <operation error="skip">
            <search><![CDATA[<div class="block-cart">
                                <div class="shopping_cart">
                                    <?php echo $cart; ?>
                                </div>
                            </div>]]></search>
            <add position="after"><![CDATA[<?php } ?>]]>
            </add>
        </operation>
    </file>

</modification>
I Want to make with ocmod file, not with hardcode.

Newbie

Posts

Joined
Thu Mar 31, 2016 9:34 pm

Post by OSWorX » Mon Jul 08, 2019 8:36 pm

This code wil never work.
1.
not

Code: Select all

<file path="catalog/view/theme/{so-mobile,so-revo}/template/header/header1.tpl">
instead

Code: Select all

<file path="catalog/view/theme/*/template/header/header1.tpl">
or if you want to change a specific file only, name only that

2. wrong

Code: Select all

<search><![CDATA[<div class="block-cart">
                                <div class="shopping_cart">
                                    <?php echo $cart; ?>
                                </div>
                            </div>]]></search>
you can search only for one line (or use regex):

Code: Select all

<?php echo $cart; ?>
3. why so complicated?
Use the enclosed mod, try it and report back.

Attachments


Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria
Who is online

Users browsing this forum: No registered users and 3 guests