Hi - a client is interested in having different images for each subproduct displayed in the cart. I can attach images to the subproduct nodes and get at them in the cart no problem.
Couple questions came up I wasn't sure about:
1) When is a subproduct deleted & recreated? If they go add images to all the subproducts, I wouldn't want them to get wiped out if a change was made to a parent product. Or at least let them know what would trigger that.
2) I believe new variants are only being created when added to the basket - is it possible to run a "create all" function? Or is that what cron is doing?
Thanks a lot, great module.
-Greg
Comments
Comment #1
brmassa commentedGreg,
thanks for reporting. lets go:
1* if you use a module like image.module directly on parent product, it will probably give you trouble when you delete/recrete the subproduct. its because image.module believes the image is only linked to one product (i reported this to the dev team but they refused to correct this, claming its a subproduct module problem). delete/recreate WONT change any attribute data, so any image attached to attributes will remain ok. To attach images to parent products, use modules like Slideshow creator or some other filter on body.
2* I once wrote a cron function to create some subproducts on cron but i found two problems: to avoid a huge overload, it should create only a few number of subproducts per cron, however, it was very complex to store a array telling "how many subproducts it was created already". The second problem was on editing the parent product/attribute: instead updating all existing subproduct, which is a HUGEEEE server overload (many times getting PHP timeout) i design to delete all of them. but on product with hundreds subproducts, even deleting was getting problems. Bottom line, i removed the cron feature.
cheers,
massa
Comment #2
Anonymous (not verified) commentedHey Massa - thanks, as always.
I am using node_images, great way to handle product images. What I am noticing though is if I update the parent product in any way on the current version of ec_live, the subproducts (if there are any) get deleted. And then next time they are added to the cart they get created again with new node ID's. Reading your response above, sounds like it shouldn't work this way? Basically they want to go edit the subproduct nodes after they are all created, but still make updates to the parent products when needed - looking for the best way to do that.
Thanks for the background on "create all"
These clients have also requested a couple nice features I can't do -- adding support for checkboxes, and adding a qty field (that updates price still) to the product page. Could pay you to hammer these out if you're interested in bidding on some side work. Hit my contact page if so.
Thanks!~-greg
Comment #3
Anonymous (not verified) commentedOne more point, not sure I was clear - they are trying to have different images used for each of the product variants, not the parent image. Then in the cart they show a little thumbnail of the subproduct/image combo. Makes for a nice cart, but is a pita...
Comment #4
brmassa commentedGreg,
* about "delete when editing the parent product and recreate with another Node ID" -> its the way it works. im planning a way to preserve the subproducts, but not for now
* about "checkbox option" -> im going to add this feature on eCommerce Subproducts 4. its already on my postponed list.
* about "quantity field" -> i didnt get it. what about the quantity? like multiple RAM memories on your customizable computer?
* about the pictures -> as i said, you can and should add images to attributes individually, but not to create a combined image like "cotton-black-shirt.png" on selecting the cotton and black attributes from a shirt.
regards,
massa
Comment #5
(not verified) commentedComment #6
reg commentedWhile we are waiting for ec4 I would like to offer this interim measure for us ec3 users of Live Subproducts.
Be warned, this is just an interim solution and is by no means perfect. Mainly, if you change the options so that currently created pages are no longer valid, it will not delete the no longer valid pages, you have do that yourself one at a time. Also, it does not follow the restrictions of the attributes. If someone wants to add that on, please do so. You would modify the logic in the routine ec_live_subproducts_restrict_options which you will see is currently very basic.
What this does do is the following:
- Disabled the deleting of product variations just because you alter the parent product.
- Adds a button "Submit & Create Variations" - Creates all not yet created variations
- Adds a button "Submit & Remove Variations" - Removes all variations
Much more could be done but please don't ask me for it. This is just a temporary minimal enhancement while waiting to go to ec4 which everyone in ecommerce is pushing.
I haven't created a patch however posted below are the routines that I altered and added. All you have to do is update them in the ec_live_subprdoucts module.
I hope this helps a few other people.
Here is the version I modified:
Here are the routines that I modified and added:
Add this routine:
Replace this routine with below:
Note, I am only showing the part to add into the routine below. DO NOT replace your entire ec_live_subproducts_pproduct_attributes with below. insert the code in the code block below, after the code:
$form["submit"] = array(
"#type" => "submit",
"#value" => t("Submit")
);
and above the code:
$header = array( t("Parent Product"), t("Subproducts"));
$output = theme('table', $header, $rows);
return $form;
in the ec_live_subproducts_pproduct_attributes routine. The above three lines are the last lines in the routine/function.
Note, I am only showing the case statement below that I commented out. DO NOT replace your entire ec_live_subproducts_nodeapi with below. ONLY comment out the code under -- case "update": -- as shown below.
I also removed the cron routine as it called the combine routine which has been completely rewritten and was disabled anyway.
Comment #7
reg commentedOops, I slipped up - here is the ec_live_subproducts_pproduct_attributes() function again with a minor needed fix. The same instructions apply as prefixing this function above. I.e.: don't replace the entire function, just insert the code below in the appropriate place.
Although this works for me, it all comes "as is", no guarantees etc.
Comment #8
reg commentedEh, remove the (two) lines that start with "Lg(...". That's my testing code and it will error if you don't. Sorry, it's been a long night.
Comment #9
brmassa commentedGuys,
im so deeply involved on eC4 that i really dont have the time to support EC LS anymore. if someone provides a patch, i will be glad to use it.
regards,
massa
Comment #10
brmassa commented