Hello Everyone,
Sorry if this has been asked before. I have tried to search the forum but could not find the answer. I have just created a wholesale website and disabled the view prices, add to cart options. The users have to log-in in order to view prices and make a purchase.
I want to display a message under each category or if possible under each product which says "Please log-in to view prices" and when a user has logged in then this message should automatically disappear.
Can anyone please tell me, which files do I need to edit in order for this to work as I am not that good with PHP.
Thank You for your time and would really appreciate the help.
Sorry if this has been asked before. I have tried to search the forum but could not find the answer. I have just created a wholesale website and disabled the view prices, add to cart options. The users have to log-in in order to view prices and make a purchase.
I want to display a message under each category or if possible under each product which says "Please log-in to view prices" and when a user has logged in then this message should automatically disappear.
Can anyone please tell me, which files do I need to edit in order for this to work as I am not that good with PHP.
Thank You for your time and would really appreciate the help.
Just put
In your templates where you want it to appear. I added a login-to-view class to make the styling easier for you
Code: Select all
<?php if(!$this->user->isLogged()) : ?>
<span class="login-to-view">Please log-in to view prices</span>
<?php endif; ?>
For the category page edit:
catalog / view / theme / <theme name> / template / product / category.tpl
For the product page edit:
catalog / view / theme / <theme name> / template / product / product.tpl
As for the fatal error, it doesn't seem to be able to locate the function in the system library.
Would it not be possible to do the following in the product page:
And the following in the category page:
Joel
catalog / view / theme / <theme name> / template / product / category.tpl
For the product page edit:
catalog / view / theme / <theme name> / template / product / product.tpl
As for the fatal error, it doesn't seem to be able to locate the function in the system library.
Would it not be possible to do the following in the product page:
Code: Select all
<?php if ($price) { ?>
<span class="login-to-view">Please log-in to view prices</span>
<?php } ?>
Code: Select all
<?php if ($product['price']) { ?>
<span class="login-to-view">Please log-in to view prices</span>
<?php } ?>
Joel
In catalog / controller / product / category.php
Find:
After Add:
In catalog / view / theme / <your theme> / template / product / category.tpl
Add:
In catalog / view / theme / <your theme> / template / product / product.tpl
Add:
Find:
Code: Select all
$results = $this->model_catalog_product->getProducts($data);
Code: Select all
if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
$this->data['price'] = true;
} else {
$this->data['price'] = false;
}
Add:
Code: Select all
<?php if (!$price) { ?>
<span class="login-to-view">Please log-in to view prices</span>
<?php } ?>
Add:
Code: Select all
<?php if (!$price) { ?>
<span class="login-to-view">Please log-in to view prices</span>
<?php } ?>
This is te site: www.wildflowerstudio-wholesale.com
where in the category and product tpl do I insert the script so it 'log in to view prices' displays in the pop up as you hover over the image?
where in the category and product tpl do I insert the script so it 'log in to view prices' displays in the pop up as you hover over the image?
In catalog / view / theme / <your theme> / template / product / category.tpl
Find:
Add After:
In catalog / view / theme / <your theme> / template / product / product.tpl
Find:
Add After:
You will also have to make modifications to any product modules you use on your site. The changes should be similar to the category.tpl changes above.
Joel
Find:
Code: Select all
<?php if ($product['price']) { ?>
<div class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
<?php } ?>
<?php if ($product['tax']) { ?>
<br />
<span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
<?php } ?>
</div>
<?php } ?>
Code: Select all
<?php else { ?>
<div class="price">
<span class="login-to-view">Please log-in to view prices</span>
</div>
<?php } ?>
Find:
Code: Select all
<?php if ($price) { ?>
<div class="price"><?php echo $text_price; ?>
<?php if (!$special) { ?>
<?php echo $price; ?>
<?php } else { ?>
<span class="price-old"><?php echo $price; ?></span> <span class="price-new"><?php echo $special; ?></span>
<?php } ?>
<br />
<?php if ($tax) { ?>
<span class="price-tax"><?php echo $text_tax; ?> <?php echo $tax; ?></span><br />
<?php } ?>
<?php if ($points) { ?>
<span class="reward"><small><?php echo $text_points; ?> <?php echo $points; ?></small></span> <br />
<?php } ?>
<?php if ($discounts) { ?>
<br />
<div class="discount">
<?php foreach ($discounts as $discount) { ?>
<?php echo sprintf($text_discount, $discount['quantity'], $discount['price']); ?><br />
<?php } ?>
</div>
<?php } ?>
</div>
<?php } ?>
Code: Select all
<?php else { ?>
<div class="price">
<span class="login-to-view">Please log-in to view prices</span>
</div>
<?php } ?>
Joel
Find:
Change At End Of The Above:
To:
And Add After:
Code: Select all
<?php if ($price) { ?>
<div class="price"><?php echo $text_price; ?>
<?php if (!$special) { ?>
<?php echo $price; ?>
<?php } else { ?>
<span class="price-old"><?php echo $price; ?></span> <span class="price-new"><?php echo $special; ?></span>
<?php } ?>
<br />
<?php if ($tax) { ?>
<span class="price-tax"><?php echo $text_tax; ?> <?php echo $tax; ?></span><br />
<?php } ?>
<?php if ($points) { ?>
<span class="reward"><small><?php echo $text_points; ?> <?php echo $points; ?></small></span> <br />
<?php } ?>
<?php if ($discounts) { ?>
<br />
<div class="discount">
<?php foreach ($discounts as $discount) { ?>
<?php echo sprintf($text_discount, $discount['quantity'], $discount['price']); ?><br />
<?php } ?>
</div>
<?php } ?>
</div>
<?php } ?>
Code: Select all
<?php } ?>
Code: Select all
<?php } else { ?>
Code: Select all
<div class="price">
<span class="login-to-view">Please log-in to view prices</span>
</div>
<?php } ?>
Multiple Extensions for this already exist for latest Versions:
https://www.opencart.com/index.php?rout ... ew%20price
Ernie
https://www.opencart.com/index.php?rout ... ew%20price
Ernie
My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Who is online
Users browsing this forum: No registered users and 19 guests