You have mentioned that before but where do I put this?JAY6390 wrote:If you want it to show whenever the stock level isn't -999 you can just simply use
<?php if($stock != -999): ?>
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
what the best option for me to get the add cart button removed if that part of the code jay put isn't there..
Code: Select all
<?php echo $header; ?><?php echo $column_left; ?>
<div id="content">
<div class="grid_5 no-margin-left">
<a id="product-large" href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="thickbox" rel="overlay['gallery']"><img src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" id="image" style="margin-bottom: 3px;" /></a>
<?php if ($images) : ?>
<ul id="product-thumbs">
<?php foreach ($images as $image) : ?>
<li><a href="<?php echo $image['popup']; ?>" title="<?php echo $heading_title; ?>" class="thickbox" rel="overlay['gallery']"><img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a></li>
<?php endforeach; ?>
</ul>
<?php else : ?>
<div id="no-img"><?php echo $text_no_images; ?></div>
<?php endif; ?>
</div>
<div class="grid_3 margin-left">
<div id="product-title"><h2><?php echo $heading_title; ?> </h2>
<?php if ($display_price) { ?>
<p class="pricebig">
<?php if (!$special) { ?>
<?php echo $price; ?>
<br \>
<font style="font-size: 10pt; color: #000; text-transform: lowercase;">sku# <?php echo $product_info['sku']; ?></font>
<?php } else { ?>
<em class="special">Normal Price: <?php echo $price; ?></em> <em>Special Price: <?php echo $special; ?></em>
<?php } ?>
</p>
<?php } ?>
<span class="stock">
<?php echo $text_availability; ?> <?php echo $stock; ?>
</span>
</span>
</div>
<div id="buying-area">
<?php if ($display_price) { ?>
<form action="<?php echo str_replace('&', '&', $action); ?>" method="post" enctype="multipart/form-data" id="product">
<fieldset>
<?php if ($options) { ?>
<table style="width: 100%;">
<?php foreach ($options as $option) { ?>
<tr>
<td>
<?php echo $option['name']; ?>:<br />
<select name="option[<?php echo $option['option_id']; ?>]" class="input-auto">
<?php foreach ($option['option_value'] as $option_value) { ?>
<option value="<?php echo $option_value['option_value_id']; ?>"><?php echo $option_value['name']; ?>
<?php if ($option_value['price']) { ?>
<?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?>
<?php } ?>
</option>
<?php } ?>
</select>
</td>
</tr>
<?php } ?>
</table>
<?php } ?>
<?php if ($display_price) { ?>
<?php if ($discounts) { ?>
<b><?php echo $text_discount; ?></b><br />
<table style="width: 100%;">
<tr>
<td style="text-align: right;"><b><?php echo $text_order_quantity; ?></b></td>
<td style="text-align: right;"><b><?php echo $text_price_per_item; ?></b></td>
</tr>
<?php foreach ($discounts as $discount) { ?>
<tr>
<td style="text-align: right;"><?php echo $discount['quantity']; ?></td>
<td style="text-align: right;"><?php echo $discount['price']; ?></td>
</tr>
<?php } ?>
</table>
<?php } ?>
<?php } ?>
<?php echo $text_qty; ?>
<input type="text" name="quantity" size="3" value="<?php echo $minimum; ?>" class="input-auto" />
<a onclick="$('#product').submit();" id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a>
<?php if ($minimum > 1) { ?><br/><small><?php echo $text_minimum; ?></small><?php } ?>
<input type="hidden" name="product_id" value="<?php echo $product_id; ?>" />
<input type="hidden" name="redirect" value="<?php echo str_replace('&', '&', $redirect); ?>" />
</fieldset>
</form>
<?php } ?>
</div>
<div id="product-meta">
<div id="delivery-note"><img src="catalog/view/theme/letsallbuy/image/structure/delivery.png" alt="Free delivery" /></div>
<div style="width: 100%;">
<table>
<tr>
<td>
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="princessfily">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<br/>
<a name="fb_share" type="button_count" href="http://www.facebook.com/sharer.php">Share to facebook</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
<br/>
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id='.$this->request->get['product_id']); ?>&layout=standard&show_faces=false&width=280&action=like&colorscheme=light&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:270px; height:35px;" allowTransparency="true">
</iframe>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#n-desc">Description</a></li>
<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#n-rel">Related</a></li>
<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#n-tag">Tags</a></li>
<?php /* <li class="ui-state-default ui-corner-top"><a href="#n-review">Reviews</a></li> */ ?>
<li class="ui-state-default ui-corner-top"><a href="#n-info">Other info</a></li>
</ul>
<div id="n-desc" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
<?php echo $description; ?>
</div>
<div id="n-rel">
<?php if ($products) { ?>
<?php for ($i = 0; $i < sizeof($products); $i = $i + 4) { ?>
<?php for ($j = $i; $j < ($i + 4); $j++) { ?>
<div class="grid_3 product">
<?php if (isset($products[$j])) { ?>
<a href="<?php echo str_replace('&', '&', $products[$j]['href']); ?>"><img src="<?php echo $products[$j]['thumb']; ?>" title="<?php echo $products[$j]['name']; ?>" alt="<?php echo $products[$j]['name']; ?>" /></a><br />
<a href="<?php echo str_replace('&', '&', $products[$j]['href']); ?>"><?php echo $products[$j]['name']; ?></a>
<span style="color: #999; font-size: 11px;"><?php echo $products[$j]['model']; ?></span>
<?php if ($display_price) { ?>
<?php if (!$products[$j]['special']) { ?>
<span class="price"><?php echo $products[$j]['price']; ?></span>
<?php } else { ?>
<span class="line-through"><?php echo $products[$j]['price']; ?></span> <span style="color: #F00;"><?php echo $products[$j]['special']; ?></span>
<?php } ?>
<a class="button_add_small" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" >Add to cart</a>
<?php } ?>
<?php if ($products[$j]['rating']) { ?>
<img src="catalog/view/theme/default/image/stars_<?php echo $products[$j]['rating'] . '.png'; ?>" alt="<?php echo $products[$j]['stars']; ?>" />
<?php } ?>
<?php } ?>
</div>
<?php } ?>
<?php } ?>
<?php } else { ?>
<p class="warning"><?php echo $text_no_related; ?></p>
<?php } ?>
</div>
<div id="n-tag">
<?php if ($tags) { ?>
<h3>Browse similar categories</h3>
<ul class="bullet-list">
<?php foreach ($tags as $tag) { ?>
<li><a href="<?php echo $tag['href']; ?>"><?php echo $tag['tag']; ?></a></li>
<?php } ?>
</ul>
<?php } ?>
</div>
<?php
/*
<div id="n-review" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide">
<?php if ($review_status) { ?>
<h3>Review this product</h3>
<label><?php echo $entry_name; ?></label>
<input type="text" name="name" value="" />
<label><?php echo $entry_review; ?></label>
<textarea name="text" rows="8"></textarea>
<p><?php echo $text_note; ?></p>
<label><?php echo $entry_rating; ?></label>
<p><span><?php echo $entry_bad; ?></span>
<input type="radio" name="rating" value="1" />
<input type="radio" name="rating" value="2" />
<input type="radio" name="rating" value="3" />
<input type="radio" name="rating" value="4" />
<input type="radio" name="rating" value="5" />
<span><?php echo $entry_good; ?></span></p>
<label><?php echo $entry_captcha; ?></label>
<input type="text" name="captcha" value="" autocomplete="off" />
<img src="index.php?route=product/product/captcha" id="captcha" />
<div class="buttons">
<table>
<tr>
<td align="right"><a onclick="review();" class="button"><span>Submit for moderation</span></a></td>
</tr>
</table>
</div>
<?php } ?>
</div>
*/
?>
<div id="n-info" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide">
<?php if ($manufacturer) { ?>
<h3><?php echo $text_manufacturer; ?></h3>
<p><a href="<?php echo str_replace('&', '&', $manufacturers); ?>"><?php echo $manufacturer; ?></a></p>
<?php } ?>
<?php if ($review_status) { ?>
<h3><?php echo $text_average; ?></h3>
<?php if ($average) { ?>
<img src="catalog/view/theme/default/image/stars_<?php echo $average . '.png'; ?>" alt="<?php echo $text_stars; ?>" style="margin-top: 2px;" />
<?php } else { ?>
<p><?php echo $text_no_rating; ?></p>
<?php } ?>
<?php } ?>
</div>
</div>
</div>
<?php echo $footer; ?>
In the catalog\controller\product\product.php
Find:
Code: Select all
$this->data['model'] = $product_info['model'];
Code: Select all
$this->data['stock_count'] = $product_info['quantity'];
Find:
Code: Select all
<?php echo $text_qty; ?>
<input type="text" name="quantity" size="3" value="<?php echo $minimum; ?>" />
<a onclick="$('#product').submit();" id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a>
<?php if ($minimum > 1) { ?><br/><small><?php echo $text_minimum; ?></small><?php } ?>
Code: Select all
<?php if($stock_count > -999) { ?>
<div class="content">
<?php echo $text_qty; ?>
<input type="text" name="quantity" size="3" value="<?php echo $minimum; ?>" />
<a onclick="$('#product').submit();" id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a>
<?php if ($minimum > 1) { ?><br/><small><?php echo $text_minimum; ?></small><?php } ?>
</div>
<?php } ?>
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
i dont understand the bit where you put add before.. should it be replaced with..i2Paq wrote:OK, thanks to zrxraver we got it working with a fixed amount of -999 (or whatever you needs are).
In the catalog\controller\product\product.php
Find:Add before: (should this be replace with)Code: Select all
$this->data['model'] = $product_info['model'];
Code: Select all
$this->data['stock_count'] = $product_info['quantity'];
No, find that first line and add that second line before.letsallbuy wrote:i dont understand the bit where you put add before.. should it be replaced with..i2Paq wrote:OK, thanks to zrxraver we got it working with a fixed amount of -999 (or whatever you needs are).
In the catalog\controller\product\product.php
Find:Add before: (should this be replace with)Code: Select all
$this->data['model'] = $product_info['model'];
Code: Select all
$this->data['stock_count'] = $product_info['quantity'];
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
This works great with category.tpl same as manufacturer.tpli2Paq wrote:To hide the + see below:
SXGuy wrote:in catalog/controller/product/category.php
find
add underneathCode: Select all
'price' => $price,
in catalog/view/theme/default/template/product/category.tplCode: Select all
'quantity' => $result['quantity'],
find
replace withCode: Select all
<a class="button_add_small" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" > </a>
Code: Select all
<?php if ($products[$j]['quantity'] > 0 ) { ?> <a class="button_add_small" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" > </a> <?php } ?>
Anyone got an idea how i can make it work for modules? like latest and bestseller?
I just removed the + there so customers have to go into the product page to order, or not if the button is hiddenronnie84 wrote:This works great with category.tpl same as manufacturer.tpl
Anyone got an idea how i can make it work for modules? like latest and bestseller?
Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
Yep thats the easy way :-)i2Paq wrote:I just removed the + there so customers have to go into the product page to order, or not if the button is hiddenronnie84 wrote:This works great with category.tpl same as manufacturer.tpl
Anyone got an idea how i can make it work for modules? like latest and bestseller?
it might also prevent customers from actually adding it to the cart.
still open for ideas
thanks in advance
This worked very nicely for me, Thanks.i2Paq wrote:OK, thanks to zrxraver we got it working with a fixed amount of -999 (or whatever you needs are).
In the catalog\controller\product\product.php
Find:Add before:Code: Select all
$this->data['model'] = $product_info['model'];
In catalog\view\theme\default\template\product\product.tplCode: Select all
$this->data['stock_count'] = $product_info['quantity'];
Find:Replace with:Code: Select all
<?php echo $text_qty; ?> <input type="text" name="quantity" size="3" value="<?php echo $minimum; ?>" /> <a onclick="$('#product').submit();" id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a> <?php if ($minimum > 1) { ?><br/><small><?php echo $text_minimum; ?></small><?php } ?>
Code: Select all
<?php if($stock_count > -999) { ?> <div class="content"> <?php echo $text_qty; ?> <input type="text" name="quantity" size="3" value="<?php echo $minimum; ?>" /> <a onclick="$('#product').submit();" id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a> <?php if ($minimum > 1) { ?><br/><small><?php echo $text_minimum; ?></small><?php } ?> </div> <?php } ?>
Thx!
But how can i replace this with an image? So i can put a "sold out" image?
Code: Select all
<?php if ($stock == 'In Stock' || $stock > 0){ ?>
<div class="content">
<?php echo $text_qty; ?>
<input type="text" name="quantity" size="3" value="<?php echo $minimum; ?>" />
<a onclick="$('#product').submit();" id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a>
<?php if ($minimum > 1) { ?><br/><small><?php echo $text_minimum; ?></small><?php } ?>
</div>
<div>
<input type="hidden" name="product_id" value="<?php echo $product_id; ?>" />
<input type="hidden" name="redirect" value="<?php echo str_replace('&', '&', $redirect); ?>" />
</div>
<?php } ?>
</form>
However, the (-999) product can still be added to the cart by clicking the "+" sign when the small version of the product is displayed in the search results display.
I found a thread suggesting changes to a product.php page but couldn't find the referenced file in the referenced subdirectory.
Any ideas??
are not recommended!
Because any other existing and up coming template would be affected by this modification!!!
So here is my idea of how this bug could be fixed, without changing the template.
May there could be some further adjustments. If so, feel free to let me know.
add to upload/catalog/controller/product/product.php
if ($product_info['quantity'] > 0) {
$this->data['button_cart'] = $this->language->get('button_cart');
} else {
$this->data['text_qty'] = $this->language->get('');
$this->data['minimum'] = $this->language->get('');
$this->data['button_cart'] = $this->language->get('1');
$this->data['text_or'] = $this->language->get('');
$this->data['button_wishlist'] = $this->language->get('');
$this->data['button_compare'] = $this->language->get('');
}
Deari2Paq wrote:To hide the + see below:
SXGuy wrote:in catalog/controller/product/category.php
find
add underneathCode: Select all
'price' => $price,
in catalog/view/theme/default/template/product/category.tplCode: Select all
'quantity' => $result['quantity'],
find
replace withCode: Select all
<a class="button_add_small" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" > </a>
Code: Select all
<?php if ($products[$j]['quantity'] > 0 ) { ?> <a class="button_add_small" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" > </a> <?php } ?>
How to do this in 1.5.1.1?
I manage to get the product.tpl working but not the category, basically I test the variable $stock but it does not seem to work as in products.tpl
Regards
Shiok Guy
Which Function and where? Sorry I am kind of green here..dirtyharry wrote:Any changes made in view/theme/default/template/product.tpl
are not recommended!
Because any other existing and up coming template would be affected by this modification!!!
So here is my idea of how this bug could be fixed, without changing the template.
May there could be some further adjustments. If so, feel free to let me know.
add to upload/catalog/controller/product/product.php
if ($product_info['quantity'] > 0) {
$this->data['button_cart'] = $this->language->get('button_cart');
} else {
$this->data['text_qty'] = $this->language->get('');
$this->data['minimum'] = $this->language->get('');
$this->data['button_cart'] = $this->language->get('1');
$this->data['text_or'] = $this->language->get('');
$this->data['button_wishlist'] = $this->language->get('');
$this->data['button_compare'] = $this->language->get('');
}
Regards
Shiok guy
Many thanks for help if you could. Richard
http://www.opencart.com/index.php?route ... on_id=4358
See the pictures from the "Additional Images" tab, and you'll get the idea
Also, there's something similar for the options:
http://www.opencart.com/index.php?route ... on_id=4468
See all my extensions: https://www.opencart.com/index.php?rout ... 20OpenCart
Users browsing this forum: No registered users and 119 guests