Post by ahmedatwa » Mon May 23, 2016 4:30 pm

I'm attempting to add outofstock label to product.tpl image

Code: Select all

<?php if ($product_info['quantity'] <= 0) {?>
                            <img class="outofstock" width="120" height="120" style="z-index: 1000; position: absolute; top: 0; left: 0" src="image/data/oos.png" alt=""> 

                <?php } else { ?>
                <a href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="imagezoom">
                    <img src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" id="image"  data-zoom-image="<?php echo $popup; ?>" class="product-image-zoom img-responsive"/> </a></div>
                    <?php }?>
i'm getting this into front end

Code: Select all

Fatal error: Call to a member function get() on a non-object in index.php on line 101

New member

Posts

Joined
Sat Mar 05, 2016 5:22 pm

Post by opencartboost » Mon May 23, 2016 5:05 pm

Use main product (not related product), use

Code: Select all

<?php if ($quantity <= '0') { ?>
instead of

Code: Select all

<?php if ($product_info['quantity'] <= 0) {?>
But you still need add code below in file product.php,

Code: Select all

$data['quantity'] 	= $product_info['quantity'];
just add code above after

Code: Select all

$data['model'] = $product_info['model'];

Active Member

Posts

Joined
Thu Jul 09, 2015 5:59 am

Post by ahmedatwa » Mon May 23, 2016 5:17 pm

Thanks So much

New member

Posts

Joined
Sat Mar 05, 2016 5:22 pm

Post by viethemes » Mon May 23, 2016 11:30 pm

You may like this extension https://isenselabs.com/products/view/la ... r?bs=label. No need to know about code.

http://www.viethemes.com - OpenCart turtorials, news, tips and stricks, extension

Our extensions:
Visual Theme Editor - Powerful tool for customizing style of any theme visually
Live Theme Editor - Customize layout, colors, backgrounds, fonts of the default theme
Theme Animation - Animation Editor for any theme

Extra Positions PRO, Custom JavaScript, Custom CSS and others


User avatar
Active Member

Posts

Joined
Thu Jan 08, 2015 12:17 pm


Post by adytzul89 » Tue Jul 25, 2017 5:36 pm

Hello,

I want to use something similar on the product category page, or at least to display text in stock.
Do you have any idea?

Thank you!

Newbie

Posts

Joined
Tue Jul 25, 2017 3:30 pm

Post by ostechnologies » Tue Jul 25, 2017 6:57 pm

Go through this post viewtopic.php?t=87854

It might help you.

Opencart Expert | sales[at]ost.agency
Skype - manish.osuniverse | Gtalk - manishmt

Extensions for Opencart @ https://www.ost.agency/product/product- ... extensions
ost.agency - ecommerce website design, development and digital company


User avatar
Active Member

Posts

Joined
Mon Apr 06, 2015 1:30 pm

Post by GoGo OpenCart » Tue Jul 25, 2017 11:30 pm

I have two modules that might help you with what you want:

https://www.opencart.com/index.php?rout ... on_id=4358

And:

https://www.opencart.com/index.php?rout ... on_id=4730

If you have any questions, feel free to write me a PM ;)

See all my extensions: https://www.opencart.com/index.php?rout ... 20OpenCart


User avatar
Active Member

Posts

Joined
Mon Nov 14, 2011 11:30 pm

Post by IP_CAM » Wed Jul 26, 2017 1:00 am

This is my theme/template/product/product.tpl File Description Section Content:

Code: Select all

<div class="description">
<?php if ($manufacturer) { ?>
<span><?php echo $text_manufacturer; ?></span> <a href="<?php echo $manufacturers; ?>"><?php echo $manufacturer; ?></a><br />
<?php } ?>
<span><?php echo $text_model; ?></span> <?php echo $model; ?><br />
<?php if ($location) { ?>
<span><?php echo $text_location; ?></span> <?php echo $location; ?><br />
<?php } ?>
<?php if ($reward) { ?>
<span><?php echo $text_reward; ?></span> <?php echo $reward; ?><br />
<?php } ?>
// I ADDED/CHANGED CONTENT FROM HERE //
<span><?php echo $text_stock; ?></span> 
<?php if ($quantity <= '0') { ?> 0
<img width="120" height="120" style="z-index: 1000; position: absolute; top: 0; right: 30px;" src="image/data/oos.png" alt="out of stock!"> 
<?php } else { ?>
<?php echo $stock; ?>
<?php }?>
// TO HERE !//
</div>
catalog/controller/product/product.php

Code: Select all

in Version v.1.5.6.x:
$this->data['reward'] = $product_info['reward'];
$this->data['points'] = $product_info['points'];
---
I added THIS LINE:
---
$this->data['quantity'] = $product_info['quantity'];
---

Code: Select all

Assumed in Version v.2.x:
$data['reward'] = $product_info['reward'];
$data['points'] = $product_info['points'];
---
ADD THIS LINE:
$data['quantity'] = $product_info['quantity'];
to hopefully get this Result out of it::
http://www.ocshop.li/shop/index.php?rou ... uct_id=653
compared to this, if Products exist:
http://www.ocshop.li/shop/index.php?rou ... ct_id=1586
after you cleared out your OcMod and VqMod Cache Content in full.
Good Luck
Ernie
---
Image

Attachments

no_stock_info_image.jpg

no_stock_info_image.jpg (63.65 KiB) Viewed 1576 times


I'm rarely active at the OC Forum lately. To reach me, contact: jti@jacob.ch
A Demoversion of my free OpenCart LIGHT v.1.5.6.5 Software Edition
can be seen in real Action here: http://www.jti.li/shop/
---
1'300+ FREE OC Extension-Repositories - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
---
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 43 guests