Post by spawng4 » Sat Feb 20, 2016 5:07 am

Hi
i am looking for some suggestion to Opencart 2 extension to help me with one task.

I need to be able to allow to the cart only Stock Qty.

Right now you can have 20 items in stock for example and you are allowed to add 22 or more qty of that item to the cart.
Then at the checkout it asks you to adjust to proper qty.

Its kinda inconvenient

is there a way to only allow to add Stock Qty to the Cart extension ?

Anybody knows how to do it?

Thanks

Newbie

Posts

Joined
Sat Feb 20, 2016 5:03 am

Post by IP_CAM » Mon Feb 22, 2016 6:52 am

This would be a kind of QUICK-FIX Solution for this, I cannot think of anything else, simpler, or better:

Sorry! We only have X in stock OC v.1.5 - 1.5.6.x (?): (OC v.2 Version shown below!)
https://www.opencart.com/index.php?rout ... n_id=24388
---
Image
---
Above extension can be made to work with v.1.5.6.4 Versions, by fixing this:

Code: Select all

in the Extension .xml File, in the Section:
<file name="catalog/view/theme/*/template/product/product.tpl">
replace this line:
<search position="before"><![CDATA[if (json['error']['profile']) {]]></search>
with this line:
<search position="before"><![CDATA[if (json['error']['option']) {]]></search>
plus in the Section:
<file name="catalog/controller/checkout/cart.php">
replace this line:
<search position="before"><![CDATA[if (isset($this->request->post['profile'])) {]]></search>
with this line:
<search position="before"><![CDATA[if (isset($this->request->post['option'])) {]]></search>
---
Just tested, it works the same on my C v.2.1.0.2 Test Shop! One cannot add, if Stock is not sufficient.
---
or another Stock Modifier, but untested:
Low Stock Quantity Notifier OC v.2.x
http://www.opencart.com/index.php?route ... n_id=25630
-----
OpenCart v.2.1.0.2 Version tested VqMod:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id><![CDATA[Sorry! We only have X in stock]]></id>
<version><![CDATA[OC v.2.x]]></version>
<vqmver><![CDATA[2.5]]></vqmver>
<author><![CDATA[webitas.lt - Ernie v.2]]></author>
<file path="catalog/language/english/checkout/cart.php">
<operation error="log">
	<search position="after"><![CDATA[// Error]]>
	</search>
	<add trim="true"><![CDATA[$_['error_sorry_we_have']    = 'Sorry! We only have %s in stock';]]>
	</add>
</operation>
</file>
<file path="catalog/controller/checkout/cart.php">
<operation error="log">
	<search position="before"><![CDATA[if (isset($this->request->post['option'])) {]]></search>
	<add trim="true"><![CDATA[
	if ($quantity > $product_info['quantity']) {
	$json['error']['quantity'] = sprintf($this->language->get('error_sorry_we_have'), $product_info['quantity']);
	}
	]]></add>
</operation>
</file>
<file path="catalog/view/theme/*/template/product/product.tpl">
<operation error="log">
	<search position="before"><![CDATA[if (json['error']['option']) {]]></search>
	<add trim="true"><![CDATA[
	if (json['error']['quantity']) {
	$('#button-cart').after('<div class="warning">' + json['error']['quantity'] + '</div>');
	}
	]]></add>
</operation>
</file>
</modification>
OpenCart v.1.5.6.x Users, just change every :
<file path="
to:
<file name="
and, possibly change to a lower VqMod Version Mumber, to make it work in yours...
sample:
<vqmver><![CDATA[2.4.1]]></vqmver>

Good Luck ;)
Ernie
openshop.li
Last edited by IP_CAM on Wed Apr 27, 2016 1:55 am, edited 2 times in total.

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

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

Post by IP_CAM » Mon Feb 22, 2016 9:35 am

Besides of looking swell, this Extension does NOT ALLOW, to enter more Items to the Card,
than existing in the Stock List, it cannot be 'freely' changed in Value.
I found it by pure Accident, added it to my test v.2.1.0.2, without the FIX, noted on the Extension Page,
this Fix just 'doubled' the Quantity Numbers, one field full of the same, below the other.

VQMOD Easy Quantity Selector with Settings
Authors Comment:
The input box will be convert to buttons depends on your settings. The default setting is 5;
You can also change the design in the settings using css.
.jb-btn-circle is class name for buttons
.jb-btn-circle.active is class name for default or selected button.
If the button clicked is the last one the buttons will change into a dropdown or select box.

https://www.opencart.com/index.php?rout ... n_id=23346
---
Image

Ernie
jti.li/cart/
Last edited by IP_CAM on Tue Jul 05, 2016 5:24 am, edited 1 time in total.

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

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

Post by MarkIce » Wed May 11, 2016 3:52 pm

hi,

sorry for posting in v2.0 i've tried a few time to get this vmod to work on v1.5.6.x and on theme template Pav Styleshop template

anyone know of any code or vmod i could try

cheers

New member

Posts

Joined
Sat Mar 01, 2014 5:58 am

Post by bhar » Thu Sep 29, 2016 9:54 am

it will stop me from adding products but won't show the text how do I get the text to show on oc ver 2.3?

I'm talking about this modal
http://www.opencart.com/index.php?route ... e=0&page=2

Active Member

Posts

Joined
Mon Jul 07, 2014 7:22 pm


Post by IP_CAM » Thu Sep 29, 2016 11:11 am

MarkIce wrote:anyone know of any code or vmod i could try
Well, why not just trying the Original VqMod, it does not cost anything ! :D
I just test-'downgraded' the Front Side product.php file VqMod Content, version-wise,
to work with my responsive OC-2 Theme to OC v.1.5.6.5, by rewriting the OC-2 type:
$data[......
to OC 1.5 type::
$this->data[......
and matching the product.tpl placed VqMod ANCHOR, to make the VqMod be able to link in.
And, it usually works, just, one of my 'DELAYED' Scripts needs to be 're-defaulted' again, because it does not
alwas work on first click yet, I still have to reload the page sometimes, to make it work.
---
The Admin Section will still take a little more, because my OC v.1.5.6.5 Admin is not OC-2
like responsive, but it can be done as well.
---
But when it comes to PAV Themes, I could not help. After I killed a Test Shop and DB, about 2 Years ago,
when trying to remove a PAV Theme again, I never ever touched one again... :-\

But if you really want it, why not just contact the Author ? I am sure, for a few Bucks, he's gonna make one for you !
After all, you are longer around OC than I am, so, you should know, how to handle a simple VqMod by now... ::)

https://www.opencart.com/index.php?rout ... n_id=23346
---
momentarely to be seen here:
http://www.gratis-anzeiger.com/shop/ind ... ct_id=2995

Ernie
Last edited by IP_CAM on Thu Sep 29, 2016 11:21 am, edited 1 time in total.

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

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

Post by IP_CAM » Thu Sep 29, 2016 11:16 am

bhar wrote:how do I get the text to show on oc ver 2.3?
No idea, I never play around with latest Version releases, of Anything,
beeing old already, I have no spare time left to waste on prototypes ... :D
Ernie (still on my beloved WIn XP!!)

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


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 116 guests