Post by Meeker » Wed Mar 27, 2013 5:54 pm

Hi I am looking for someone to do a tiny bit of custom work please. I need to have the number of items left in stock displayed for a Product Option. See my post below.

http://forum.opencart.com/viewtopic.php ... 10#p393310

I think it is a simple job to do, but my php is not good enough. Anyone interested in quoting?

User avatar
Active Member

Posts

Joined
Thu Sep 16, 2010 5:45 am

Post by grgr » Wed Mar 27, 2013 6:36 pm

catalog/controller/product/product.php

replace

Code: Select all

    $option_value['name'],
with

Code: Select all

    ($option_value['name'] . " [" . $option_value['quantity'] . "]"),

Image Image Image Image Image Image


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm

Post by Meeker » Wed Mar 27, 2013 6:54 pm

Hi grgr,

Thanks for your reply. When I amend this on the front end, I get:

Example Option 1 []
Example Option 2 []

I tried with and without the code from the previous post in the theme/template/product/product.tpl file, but no joy. I think we are getting closer!

User avatar
Active Member

Posts

Joined
Thu Sep 16, 2010 5:45 am

Post by Meeker » Wed Mar 27, 2013 6:55 pm

PS, I also found this in very small text at the top of the page - Notice: Undefined index: quantity in /home/linweb08/c/crawfordsmd.com-1048376755/user/htdocs/catalog/controller/product/product.php on line 266Notice: Undefined index: quantity in /home/linweb08/c/crawfordsmd.com-1048376755/user/htdocs/catalog/controller/product/product.php on line 266

User avatar
Active Member

Posts

Joined
Thu Sep 16, 2010 5:45 am

Post by straightlight » Wed Mar 27, 2013 9:47 pm

replace:

Code: Select all

($option_value['name'] . " [" . $option_value['quantity'] . "]"),
with:

Code: Select all

(!empty($option_value['quantity'])) ? html_entity_decode($option_value['name'], ENT_QUOTES, 'UTF-8') . ' [' . (int)$option_value['quantity'] . ']' : html_entity_decode($option_value['name'], ENT_QUOTES, 'UTF-8') . ' [0]',

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Meeker » Wed Mar 27, 2013 9:56 pm

Editing catalog/controller/product/product.php produces in the Product Option dropdown on the frontend:

Example Option 1 [0]
Example Option 2 [0]

The error message at the top has disappeared though.

User avatar
Active Member

Posts

Joined
Thu Sep 16, 2010 5:45 am

Post by straightlight » Wed Mar 27, 2013 10:54 pm

The [0] either means that the option quantity has not been queried from the models or the true value of those quantities are truly as the found quantity result.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by paulfeakins » Wed Mar 27, 2013 11:01 pm

Yes it seems like option quantities haven't been entered properly?

Are you using an extension such as OpenStock for this?

For quick, professional OpenCart support please email info@antropy.co.uk


User avatar
Expert Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - Reigate, Surrey, United Kingdom

Post by Meeker » Wed Mar 27, 2013 11:06 pm

No I haven't. Would either of you be interested in a paid job to fix this for me? Send me a PM.

User avatar
Active Member

Posts

Joined
Thu Sep 16, 2010 5:45 am

Post by Meeker » Wed Apr 03, 2013 5:40 pm

Hi all, I finally found a solution.

In catalog/controller/product/product.php around line 266, find:

FIND:

Code: Select all

'name'            => $option_value['name'],
REPLACE WITH:

Code: Select all

'name'            => (!empty($option_value['quantity'])) ? html_entity_decode($option_value['name'], ENT_QUOTES, 'UTF-8') . ' [' . (int)$option_value['quantity'] . ']' : html_entity_decode($option_value['name'], ENT_QUOTES, 'UTF-8') . ' [0]',
Thanks....

User avatar
Active Member

Posts

Joined
Thu Sep 16, 2010 5:45 am

Post by paulfeakins » Thu Apr 04, 2013 10:59 pm

And also don't forget there needs to be a small change in the product model so that $option_value['quantity'] is available!

For quick, professional OpenCart support please email info@antropy.co.uk


User avatar
Expert Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - Reigate, Surrey, United Kingdom
Who is online

Users browsing this forum: Google [Bot] and 8 guests