Post by ianhaney » Tue Aug 22, 2017 5:30 pm

I want to be able to display the stock quantity availability on the category pages, I have put the following in on the category.tpl file but it's not showing under the price

Code: Select all

<?php echo $text_stock; ?> <?php echo $stock; ?>
I am not getting any errors, has anyone does this and got it working. I am using version 2.0.3.1

Thank you in advance

Active Member

Posts

Joined
Sun Jun 24, 2012 2:30 am

Post by IP_CAM » Tue Aug 22, 2017 7:22 pm

this could be of help:
[vQmod] - Qty on Category
https://www.opencart.com/index.php?rout ... n_id=28805

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

Post by ianhaney » Tue Aug 22, 2017 7:32 pm

Thank you appreciate it, will have a look

Active Member

Posts

Joined
Sun Jun 24, 2012 2:30 am

Post by IP_CAM » Tue Aug 22, 2017 7:49 pm

you may place the Value someplace else in the Category Display, but at least
you so have the Code, required in the Controller Section as well, to make it work.
Good Luck !
Ernie

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

Post by ianhaney » Tue Aug 22, 2017 8:15 pm

That's it, I have looked at it and yeah will place it elsewhere but as you say I have the code now to have a play around and get it to where/how I want it on the category page

Active Member

Posts

Joined
Sun Jun 24, 2012 2:30 am

Post by ianhaney » Tue Aug 22, 2017 8:39 pm

bit confused by the extension you gave me the link for, there is no coding for the category controller, it's all done in the category.tpl file, below is the coding in the xml file

Code: Select all

<modification>
	<id>Qty on Category</id>
	<version>1.0.1</version>
	<vqmver>2.3.0</vqmver>
	<author></author>
	<file name="catalog/view/theme/*/template/product/category.tpl">
		<operation>
			<search position="replace"><![CDATA[<div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" class="img-responsive" /></a></div>]]></search>
			<add><![CDATA[<div class="image"><a href="<?php echo $product['href']; ?>" id="location-<?php echo $product['product_id']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" class="img-responsive" /></a></div>]]></add>
		</operation>
		<operation>
			<search position="before"><![CDATA[<div class="button-group">]]></search>
			<add><![CDATA[<input type="text" name="quantity" value="<?php echo $product['minimum']; ?>" size="2" id="input-quantity-<?php echo $product['product_id']; ?>" class="form-control-qty" />]]></add>
		</operation>
		<operation>
			<search position="replace"><![CDATA[<button type="button" onclick="cart.add('<?php echo $product['product_id']; ?>', '<?php echo $product['minimum']; ?>');"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $button_cart; ?></span></button>]]></search>
			<add><![CDATA[<button type="button" onclick="addToCart('<?php echo $product['product_id']; ?>')"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $button_cart; ?></span></button>]]></add>
		</operation>
		<operation>
			<search position="before"><![CDATA[<?php echo $footer; ?>]]></search>
			<add><![CDATA[
			<style>
			.form-control-qty {
    		width: 50px;
    		height: 5%;
    		padding: 10px 0px 12px 0px;
    		border: medium none;
    		display: inline-block;
    		float: left;
    		background-color: #EEE;
    		color: #888;
    		line-height: 38px;
    		font-weight: bold;
    		text-align: center;
			}
			</style>
			
			<script type="text/javascript">
			function addToCart(product_id){
			    var product_id = product_id;
			    var qty = $('#input-quantity-'+product_id).val();
			    var location = $('#location-'+product_id).attr('href');
			    $.ajax({
			        url: 'index.php?route=checkout/cart/add',
			        type: 'post',
			        data: 'product_id='+product_id+'&quantity='+qty,
			        dataType: 'json',
			        beforeSend: function() {
			            $('#button-cart').button('loading');
			        },
			        complete: function() {
			            $('#button-cart').button('reset');
			        },
			        success: function(json) {
			            $('.alert, .text-danger').remove();
			            $('.form-group').removeClass('has-error');

			            if (json['error']) {
			                if (json['error']['option']) {
			                    window.location = location;
			                }

			                if (json['error']['recurring']) {
			                    window.location = location;
			                }

			                // Highlight any found errors
			                $('.text-danger').parent().addClass('has-error');
			            }

			            if (json['success']) {
			                $('.breadcrumb').after('<div class="alert alert-success">' + json['success'] + '<button type="button" class="close" data-dismiss="alert">&times;</button></div>');

			                $('#cart > button').html('<i class="fa fa-shopping-cart"></i> ' + json['total']);

			                $('html, body').animate({ scrollTop: 0 }, 'slow');

			                $('#cart > ul').load('index.php?route=common/cart/info ul li');
			            }
			        },
			        error: function(xhr, ajaxOptions, thrownError) {
			            alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
			        }
			    });
			}
			</script>
			]]></add>
		</operation>
	</file>
</modification>

Active Member

Posts

Joined
Sun Jun 24, 2012 2:30 am

Post by GoGo OpenCart » Wed Aug 23, 2017 12:30 am

I have a module which will do exactly what you want:

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

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 ianhaney » Wed Aug 23, 2017 12:49 am

Thank you, I have had a look at your extension and looks perfect, I will buy that as soon as got enough to get it in the next day or 2 at the most

Active Member

Posts

Joined
Sun Jun 24, 2012 2:30 am

Post by IP_CAM » Wed Aug 23, 2017 4:51 am

Well, it took a while, to find out, that this MINIMUM -Value did not work, so
I changed it to a QUANTITY Value, and after some hours, it seems to work.
But my Wife called, so, I will back later on this !
Ernie
http://www.openshop.li/shop/index.php?r ... ry&path=17
Last edited by IP_CAM on Wed Aug 23, 2017 8:23 am, edited 1 time in total.

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

Post by ianhaney » Wed Aug 23, 2017 5:02 am

Thank you for having a go and adjusting the coding, really appreciate it

I clicked the link but took me to a forbidden access page

Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.

Error 403

www.openshop.li
Apache/2.4

Active Member

Posts

Joined
Sun Jun 24, 2012 2:30 am

Post by GoGo OpenCart » Wed Aug 23, 2017 7:16 am

ianhaney wrote:
Wed Aug 23, 2017 12:49 am
Thank you, I have had a look at your extension and looks perfect, I will buy that as soon as got enough to get it in the next day or 2 at the most
No problem at all, take your time, I also sent you a PM with some other suggestions to modify the module according your needs, i.e. to display the Availability on other pages/modules aside the Category page, like Manufacturers, Search, and Specials pages, as well on Bestsellers, Featured, Latest, and Specials modules ;)

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 Aug 23, 2017 8:10 am

SORRY, but then, your Visitor IP-Range is blacklisted in my .HTACCESS File,
for some reason, because I consequently block Intruder-attempts, by entire
subranges, sometimes even down to the first 1-3 IP-Number-Block, if multiple
attempts trought the same main channel occurre. Try to visit the site by use of a
Proxy, that's all I can say... ::) but I really see no other way, to keep my freedom ... :laugh:
--
But this here should probably work in OC v.2.0.3.x - 2.2.x DEFAULT THEMES,
according to their Code. But I have no OC-2 , just Peku's OC2 to OC1.5 Theme,
where I made my 1.5.6.5 Version work for, so I cannot test it. And it only works
on Categories too, as it comes! It's more a Combination of 2 different Codes,
one of them from frymi
https://www.opencart.com/index.php?rout ... n_id=11522
---
and the other one from joomfla.org
https://www.opencart.com/index.php?rout ... n_id=28805
---
Good Luck ;)
Ernie
---
Image

Attachments

product_quantity_in_catagory_oc_2.png

product_quantity_in_catagory_oc_2.png (116.53 KiB) Viewed 2449 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

Post by ianhaney » Wed Aug 23, 2017 4:27 pm

Thank you, I put the xml extension in but is not showing on the category pages?

View for example http://www.it-doneright.co.uk/shop/Motherboards

Active Member

Posts

Joined
Sun Jun 24, 2012 2:30 am

Post by IP_CAM » Wed Aug 23, 2017 9:56 pm

Well, this is not a Default Theme, the Extension can therefore not work, without beeing adapted. ::)
But you could try to change this:

Code: Select all

<search position="before"><![CDATA[<div class="button-group">]]></search>
<add><![CDATA[
	<input data-toggle="tooltip" title="Products in Stock" type="text" name="quantity" value="<?php echo $product['quantity']; ?>" size="2" class="form-control-qty" />
]]></add>
into this:

Code: Select all

<search position="before"><![CDATA[<p class="price">]]></search>
<add><![CDATA[
	<p><input data-toggle="tooltip" title="Products in Stock" type="text" name="quantity" value="<?php echo $product['quantity']; ?>" size="2" class="form-control-qty" /> Products in Stock</p>
]]></add>
</operation>
in the VqMod File, to possibly make the Stock Amount visible above your Price Display,
at least from looking at your Page Source.
And you could later change the <p> </p> - Tags to some DIV Style, to make it look swell! :D
Good Luck! ;)
Ernie

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

Post by ianhaney » Thu Aug 24, 2017 7:14 pm

Thank you is perfect, just could not figure how to get the text centered, I tried text-align: center; and did not work

http://www.it-doneright.co.uk/shop/Motherboards

I also just need to do the same for the latest module etc.

Active Member

Posts

Joined
Sun Jun 24, 2012 2:30 am

Post by IP_CAM » Fri Aug 25, 2017 2:08 am

You now have this:

Code: Select all

<div class="qty-box"><p class="figure"><input data-toggle="tooltip" title="Products in Stock" ............ </p></div>
try this, the same CLASS line is used further down already, to 'center' the Price, so it should work:

Code: Select all

<div class="caption text-center qty-box"><input data-toggle="tooltip" title="Products in Stock" ............ </div>
---
To the other Sections, where you want to display this Value, you may check in the:
---
Products Quantity in Category
https://www.opencart.com/index.php?rout ... n_id=11522
---
Extension, how 'multiple Files' can be 'addressed' in a (1.5.6.x!)VqMod, to do it's Job in each one of
them, and without the need to create an 'individual' VqMod-Section for every File targeted and involved.

AT LEAST, if those Files use exactly the 'equal' VqMod ANCHOR Tags / Lines/Content, to
make a Modification work, by Nature of Things! :D

I don't know, if this the case in your Theme, and I cannot 're-produce' it in my Theme either, due to
my 'not OC default' handling of 'latest-special-e-t-c.', I therefore did not include such in the VqMod,
I published above.

But if you can't do it, GoGo OpenCart offered you a 'complete' Solution above, if you want
it to work, as you wish, you probably just have to send him all the 'latest-special-e-t-c' Theme files,
to enable him to check the Code and build the Mod accordingly.
But it will be Custom Mod, be aware of this, and such usually does not come for free ... ::)

That's all I can do for you, good Luck! ;)
Ernie

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

Post by ianhaney » Fri Aug 25, 2017 2:30 am

Thank you will give it a go, if not will get the extension that GoGo offered but thank you so much for everything and helping, really appreciate it

Active Member

Posts

Joined
Sun Jun 24, 2012 2:30 am

Post by IP_CAM » Fri Aug 25, 2017 2:52 am

no problem! Just make sure, because this STYLE - value in the VqMod
itself could have some 'decisive' visual effect, trying to optimize the 'Place'.
Ernie

Code: Select all

width: 25%;

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

Post by ianhaney » Sat Aug 26, 2017 12:17 am

I tried the changes but would not center, I think I'll buy the extension by GoGo when I can but at least for now it has the stock figures

Active Member

Posts

Joined
Sun Jun 24, 2012 2:30 am
Who is online

Users browsing this forum: No registered users and 35 guests