Post by Daga » Wed Jun 15, 2011 4:01 am

I am currently using 1.4.9.1 (and am willing to update to 1.5 if it will help). Is there a way to automatically update a product's Data -> Quantity when Option -> Quantities values are modified? The objective is to keep the quantities synchronized so that we only have to update the quantity in one location instead of two.

If there isn't an existing solution, how do I hook into the code to provide my own jQuery solution (this would take less than 10 lines). Obviously it would be the most useful in module format so that upgrades have a fighting chance.

So far I haven't found a way to accomplish either option via existing modules, forum posts, or OpenCart documentation. Links to similar modules or forum posts that I missed are welcome -- I'm not afraid of code or documentation. Thanks!

User avatar
Newbie

Posts

Joined
Wed Jun 15, 2011 3:34 am

Post by Daga » Wed Jun 22, 2011 3:49 am

*bump*

User avatar
Newbie

Posts

Joined
Wed Jun 15, 2011 3:34 am

Post by Daga » Thu Jun 30, 2011 10:17 pm

*bump* :P

User avatar
Newbie

Posts

Joined
Wed Jun 15, 2011 3:34 am

Post by SXGuy » Thu Jun 30, 2011 10:33 pm

Daga wrote:I am currently using 1.4.9.1 (and am willing to update to 1.5 if it will help). Is there a way to automatically update a product's Data -> Quantity when Option -> Quantities values are modified?
This doesnt make any sense.

If you wish to update all option quantities when 1 option has been purchased, then its simple. Dont use option quantities.

Set each option to no subtract stock, and add up every option quantity and use that as the total product quantity.

That way every time the product is purchased regardless of the option 1 will be subtracted.

You will know which option that was because it will be displayed on the order confirmation.

Thats the only way i can think of that meets what you require.


There is currently no way to keep track of option stock quantity when you "build" a product based on different options.
For example, if you sold a blue shirt size small, and your options where size, and colour.

it wont reduce the qty by 1.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by uksitebuilder » Fri Jul 01, 2011 6:23 am

The only way I can see of doing it is as follows:

Create your options like this as one option rather than 2 separate options

i.e. Option Name: Size/Colour

Values: Small/Blue, Small/Green etc etc

Then in product add your options with quantities and set subtract stock to Yes for eac option.

Total up all the quantities and put the total in the main product Data section, again setting Subtract Stock to Yes.

When someone purchases a product, both the main qty and option qty will reduce by qty purchased.

Ideal, not really. The options stocking has a long way to in development.

Likewise with restocking on cancelled orders etc

ImageImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by Daga » Fri Jul 01, 2011 3:43 pm

What Simon suggested is what we are doing right now. I was hoping for a way to automate half of the process. Oh well, thanks, guys. This is what I was afraid of from the appearance of the modules that do exist, but wanted to double-check. It may be easier for us not to track inventory at all through OpenCart. :-/

User avatar
Newbie

Posts

Joined
Wed Jun 15, 2011 3:34 am

Post by uksitebuilder » Fri Jul 01, 2011 11:02 pm

To be honest Daga, in theory it should be entirely possible using some simple javascript, becuase the product editing screen, although split up in to tabs is actually just one big screen with some javascript magic.

Leave it with me and I will see if I can code something up.

I've seen the Auto SEO Keyword script which works in a similar way but grabs the product name, model name etc as it is typed.

Therefore it should be a similar process for recognising key presses in the options quantity boxes, find all options quantity values, adding them up and dumping the total in the main quantity box.

ImageImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by Daga » Fri Jul 01, 2011 11:22 pm

Nice! Although they require the inclusion of "view/javascript/autoseo.min.js" in the administrative head template. That's all that I was really hoping for via some programmatic hook.

If you want, I can write the JavaScript. It would involve locking the overall quantity textbox if there are option quantities (to prevent accidental user entry) and then, as you noted, the addition of the other boxes is easy.

Unless you want another module under your belt. :)

User avatar
Newbie

Posts

Joined
Wed Jun 15, 2011 3:34 am

Post by uksitebuilder » Fri Jul 01, 2011 11:48 pm

Feel free to have a play, I probably wont be bale to get around to it until mid next week now (too busy with clients)

But will have a look when I can find five minutes to spare.

ImageImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by Xsecrets » Fri Jul 01, 2011 11:56 pm

Daga wrote:Nice! Although they require the inclusion of "view/javascript/autoseo.min.js" in the administrative head template. That's all that I was really hoping for via some programmatic hook.
well there are no programmatic hooks available, but I highly recommend you look into vqmod which would allow you to add it without editing the file.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by Daga » Wed Jul 06, 2011 4:26 am

Xsecrets wrote:well there are no programmatic hooks available, but I highly recommend you look into vqmod which would allow you to add it without editing the file.
vQmod is cool. :o I can take it from here and plan to post back when this is working in a way someone else may need.

User avatar
Newbie

Posts

Joined
Wed Jun 15, 2011 3:34 am

Post by phatpixel » Thu Sep 22, 2011 11:27 am

We had the same issue but I created an hourly cronjob that sums the option quantities and then updates the quantity shown on the data tab. In case it helps anyone else, here's the query:

Code: Select all

UPDATE product AS p INNER JOIN (SELECT product_option_value.product_id, SUM(product_option_value.quantity) AS quantity_sum FROM product_option_value GROUP BY product_option_value.product_id) AS pov SET p.quantity=pov.quantity_sum WHERE p.product_id=pov.product_id

Newbie

Posts

Joined
Thu Sep 22, 2011 10:36 am

Post by sanjeevsharma07 » Thu Sep 22, 2011 1:12 pm

Hello,

I want to add 1 pound or 1.5 Euro in total product price if some one select special product option ... so what is the solution of this problem can any one ask me?

version:1.5

Thank you & Regards
Sanju


Posts

Joined
Thu Sep 15, 2011 4:03 pm

Post by Penguinhead » Mon Dec 05, 2011 6:00 pm

phatpixel wrote:We had the same issue but I created an hourly cronjob that sums the option quantities and then updates the quantity shown on the data tab. In case it helps anyone else, here's the query:

Code: Select all

UPDATE product AS p INNER JOIN (SELECT product_option_value.product_id, SUM(product_option_value.quantity) AS quantity_sum FROM product_option_value GROUP BY product_option_value.product_id) AS pov SET p.quantity=pov.quantity_sum WHERE p.product_id=pov.product_id
Hmmm, this didn't work for me. I got the following email message on completion of the cron....

/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `UPDATE product AS p INNER JOIN (SELECT product_option_value.product_id, SUM(product_option_value.quantity) AS quantity_sum FROM product_option_value GROUP BY product_option_value.product_id) AS pov SET p.quantity=pov.quantity_sum WHERE p.product_id=pov.product_id'

ANY THOUGHTS what the problem might be??

Newbie

Posts

Joined
Sun Dec 04, 2011 7:01 pm
Who is online

Users browsing this forum: No registered users and 31 guests