Post by GoGo OpenCart » Sat Jan 21, 2012 1:31 am

Here's a mod I've created, which works on every page of OpenCart where the "Add to Cart" button is shown:

http://www.opencart.com/index.php?route ... on_id=4358

You can choose to disable button for all "Out of Stock" items, or leave it enabled for "Pre-Order", "2 - 3 Days", etc.

Here's another for the options as well:

http://www.opencart.com/index.php?route ... on_id=4468

PM if you want 20% discount for purchasing both ;)

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 tropnevad » Fri Jan 27, 2012 1:46 am

Thanks for releasing the usefull VQmod!

Has anyone used this for the shoppica theme? I tried to edit the xml file, the part that says

<!-- Clone this block and change default for additional themes -->

But after changing default to shoppica it does not seem to work.

Perhaps the theme is differant or I have another extension that is interfering with this. Any help/suggestions for shoppica theme would be appreciated

I did manage to get this to work for the default template of opencart 1.5.1.3, but not with shoppica

New member

Posts

Joined
Wed Jun 01, 2011 4:40 pm

Post by vytasm » Wed Feb 01, 2012 5:45 pm

mwshark wrote: I have modified the previous version as I too needed the mod to work for the latest products. I have updated the new version (attached)
I have modified it to work with related product tab. Now it changes buttons "Add to cart" to "Out of stock" and disables them for all products that are out of stock (quantity <= 0). Tested on OC 1.5.1.3 default theme.

UPDATE!
1.0.4 related product tab on the product page, on manufacturer, product compare and wishlist pagess Enjoy :drunk:

Attachments

For OpenCart v1.5.1.3

Last edited by vytasm on Wed Feb 01, 2012 8:23 pm, edited 1 time in total.

Newbie

Posts

Joined
Wed Feb 01, 2012 5:28 pm

Post by olimax » Wed Feb 01, 2012 7:47 pm

Brilliant
Thank you
Doesnt work in the wish list for me though (1.5.1.3)

User avatar
New member

Posts

Joined
Thu Dec 22, 2011 5:08 pm
Location - Barcelona & London

Post by vytasm » Wed Feb 01, 2012 8:25 pm

olimax wrote:Brilliant
Thank you
Doesnt work in the wish list for me though (1.5.1.3)
Now works on wishlist to! Updated my previous post attachment to v1.0.4 :ok:

Newbie

Posts

Joined
Wed Feb 01, 2012 5:28 pm

Post by olimax » Wed Feb 01, 2012 8:32 pm

good man. thanks

User avatar
New member

Posts

Joined
Thu Dec 22, 2011 5:08 pm
Location - Barcelona & London

Post by vytasm » Fri Feb 03, 2012 5:19 am

Change "Add to cart" button when product is out of stock. Created for OpenCart v1.5.1.3
Works on all standard theme places (Product, category, manufacturer, search, featured, specials, latest, wishlist, compare) where "Add to cart" button appears.

In v1.2.0 added new functionality.
  • When item quantity is 0 then "Add to cart" button is disabled and label is changed to "Out of stock".
  • When item quantity is less than 0 (ex. -1), then "Add to cart" button is enabled and label is changed to "Pre-Order". This allows add items into cart and checkout if checkout is enabled when items are not in stock (Admin -> System -> Settings -> (Select shop) -> Option -> set "YES" for "Stock Checkout"). If this is not enabled then Add to cart is disabled and label is set to "Out of stock"
So now it is customers can buy products even when they are not in stock, showing that information on "Add to cart" button anywhere.

UPDATED!
v1.2.1 2012.02.06 vytasm - (OpenCart v1.5.1.3)
- Bugfix: fixed problem in few modules when button was in Pre-Order state was not possible to add items to Cart.

Attachments

OpenCart v1.5.1.3
Change "Add to cart" when out of stock


Newbie

Posts

Joined
Wed Feb 01, 2012 5:28 pm

Post by vytasm » Tue Feb 07, 2012 4:46 am

Found a small bug when copying some lines.I have changed my previous post with the fixed version. Please update who has downloaded and using it :whistle:

Newbie

Posts

Joined
Wed Feb 01, 2012 5:28 pm

Post by svenman » Mon Mar 19, 2012 7:01 pm

Hi,

Thank you very much for this, it's great! However, the 'out of stock' button looks strange, the left side is square and there is grey area behind it. How do I change this? I'm very new at this...

Thanks!

Newbie

Posts

Joined
Mon Mar 19, 2012 6:59 pm

Post by vytasm » Mon Mar 19, 2012 8:18 pm

svenman wrote:Hi,
Thank you very much for this, it's great! However, the 'out of stock' button looks strange, the left side is square and there is grey area behind it. How do I change this? I'm very new at this...
Thanks!
Have you a picture, or better a link to your shop that I could see. Link you can post me using PM then I can say what is wrong. maybe I have left something with the styles... By the way what version of OC are you using?

Newbie

Posts

Joined
Wed Feb 01, 2012 5:28 pm

Post by Goncharenko » Wed Mar 21, 2012 8:52 am

vytasm, thanks very much for your mod, exactly what I was searching for.

New member

Posts

Joined
Sun Mar 18, 2012 9:21 am

Post by ikhlief » Thu Mar 29, 2012 2:59 pm

Does it work for V1.5.2.1?
Thanks

Active Member

Posts

Joined
Wed Nov 24, 2010 9:15 pm

Post by TechSitement » Tue Apr 03, 2012 5:38 pm

It doesn't appear to be working for 1.5.2.1. :-\

Awali Art
Original Imported Fine Art
Store Front
Facebook
Twiter
YouTube


User avatar
Newbie

Posts

Joined
Wed Oct 05, 2011 2:41 am


Post by msmith » Mon Apr 16, 2012 7:31 pm

TechSitement wrote:It doesn't appear to be working for 1.5.2.1. :-\
No neither of the versions work for 1.5.2.1 (not even Q's)

Active Member

Posts

Joined
Mon Oct 18, 2010 8:57 pm

Post by miran » Mon Apr 16, 2012 8:36 pm

I have updated the mod but t he "out of stock" button will show everywhere except the category page..
Maybe someone can do it, i am a newbie:) Here it goes:

Attachments


Newbie

Posts

Joined
Mon Feb 06, 2012 6:11 am

Post by frisco_aw » Thu Apr 26, 2012 2:57 am

i changed a little bit Miran's code to make it working for category. It seems to be working for me. Hopefully, it will work for you guys also. I tested with 1.5.2.1 version.

Attachments


Newbie

Posts

Joined
Thu Apr 26, 2012 2:55 am

Post by msmith » Tue May 01, 2012 12:25 am

Thanks to both of you, it's working great now !

Active Member

Posts

Joined
Mon Oct 18, 2010 8:57 pm

Post by olimax » Tue May 01, 2012 2:39 am

one small bug for that new version (1.5.2.1)
if a category is empty you get an error
Notice: Undefined variable: result in ....\vqmod\vqcache\vq2-catalog_controller_product_category.php on line 271

you need to change this

Code: Select all

	<!-- Category Controller Mod -->	
	<file name="catalog/controller/product/category.php">
		<operation error="skip"><!-- v15x -->
            <search position="before"><![CDATA[
			if ($this->config->get('config_review_status')) {
			]]></search>
            <add trim="true"><![CDATA[
	if ((float)$result['quantity']) {
					$quantity = (int)$result['quantity'];
				} else {
					$quantity = false;
				}
				]]></add>
        </operation>

to this

Code: Select all

	<!-- Category Controller Mod -->	
	<file name="catalog/controller/product/category.php">
		<operation error="skip"><!-- v15x -->
            <search position="before"><![CDATA[
			if ($this->config->get('config_review_status')) {
			]]></search>
            <add trim="true"><![CDATA[
  if(!isset($result['quantity'])) $result['quantity'] = 0;
	if ((float)$result['quantity']) {
					$quantity = (int)$result['quantity'];
				} else {
					$quantity = false;
				}
				]]></add>
        </operation>
it may need it elsewhere too but I haven't checked

User avatar
New member

Posts

Joined
Thu Dec 22, 2011 5:08 pm
Location - Barcelona & London

Post by arielito23 » Thu May 10, 2012 1:38 pm

O0 O0 O0 O0 O0 O0 O0 O0 O0

New member

Posts

Joined
Sun May 06, 2012 2:01 pm

Post by storm-cloud » Sun May 27, 2012 1:45 pm

vytasm wrote:UPDATED!
v1.2.1 2012.02.06 vytasm - (OpenCart v1.5.1.3)
- Bugfix: fixed problem in few modules when button was in Pre-Order state was not possible to add items to Cart.
Hello Vytasm,

Great Mod!

However, I have found a quirk which I hope someone may be able to resolve. Here goes, I hope it makes sense...

For Pre Order to work, this mod requires the Stock Checkout option to be enabled. This almost works perfectly. If the product stock quantity is zero the Add to Cart button will be disabled (even when Stock Checkout is enabled) and the Out of Stock button will appear. If the stock is set to a negative quantity, the Pre Order button will show up and the customer can complete Checkout... So far, so good.

However the problem is, if for example there is perhaps 2 remaining of a particular product and you do not want to sell this product when out of stock, if the customer adds 3 or more to their basket, they are still able to Checkout due to Stock Checkout being enabled.

Any ideas on how to overcome this?

Active Member

Posts

Joined
Wed Feb 22, 2012 8:07 am
Who is online

Users browsing this forum: No registered users and 20 guests