View Single Post
  #2  
Old 09-21-2015, 05:58 PM
enot's Avatar
enot enot is offline
 
Join Date: Oct 2014
Posts: 499
Default

Quote:
Originally Posted by Kai Czauderna View Post
Hello everyone, I need some help concerning coding.

Well actually it's not really coding but more like "finding the right names". What I am trying to do is getting dependant product options. For Example: different Types of T-Shirts have different Colors available and depending on what shirttype the user chooses, the other options fitting to his choice appear.

I already found this topic: http://www.ecwid.com/forums/showthread.php?t=18333
The Code provided from Matt (https://gist.github.com/makfruit/530...kfruit/5302479) worked as intended on the product browser. But my situation is different and I am kind of lost because I tried so much to make it work.

The Code works for the product browser but my page is made in Muse and the only part of "ECWID-embed-html" is the box containing the options, the quantaty and the "to-bag" button (and the bag itself but it doesn't matter) as you can see here in my testpage (http://davidshoptest.businesscatalyst.com/magni-1.html) on the right, underneath the way too large priceimage . The company I work in uses Muse for webdesign which is why I really want to find a way to make it work so even someone with no programming skills can manipulate the code only with a little guideline. I still want to do all my designs in Muse and only use the product-options, the quantaty, the to-bag button and the bag itself from ecwid.

Now to the part about the code. Of course I changed the expanderName and Flag to the needed parameters which did work just fine in the regular product browser. But when it comes to the single-product-embedding it's not doing anything anymore. I've added a window.alert on the very end of the expander function to see when it goes off. It never did. Oh it did once, but I think that was a bug because everything on the website went bananas. I think the main problem is somewhere in this part:



My java-knowledge makes me understand the code to a degree where I would say I can continue writing on it. But I just don't get the if-part from above... or at least I think it doesn't fit with the Single-Product-Embedding because it's not a whole page but a part of it...right? I also changed the .div's from productbrowser-details-etc. to singleproduct-options which had no effect.

Is anyone out there so kind to help me with this one? All I need is the examplecode from Matt to work on my Single-Product-Embedding... I would code the rest myself. We don't really like the product-browser, even with changed CSS. And making it look like the way we want would take too much time and require coding skills on a high level which we don't have. So unless we get this code working soon I have to look for another ecommerce solution unfortunately.

Thanks in advance!

Kind regards!
Hi!

The reason this script doesn't work with Single Product widget embedded to a page of your website, is the following part in the beginning:
Code:
Ecwid.OnPageLoaded.add(function(page) {
if ('PRODUCT' == page.type) {
I.e. it's only fired, if a page of Ecwid's product browser is loaded, and if this particular loaded page is "product details" page. You can read more about this in our documentation on JavaScript API, and it was created since Ecwid is an AJAX-based application, and without this API it wouldn't be possible to correctly (or, at least, easily) detect the loading of particular page inside product browser.
Single product widget, on the other hand, is located on full-featured page of your website, so in this case we won't need the part I mentioned above (and this particular event doesn't happen).

Yet, our JS API doesn't yet offer a way to detect complete loading of single product widget, so the script will have to be fired as soon as the page is loaded. Still, as a workaround, you could add delay to the script (to give the widget time to load completely), if it will be required.

Also, please refer to the following article for more info about our JavaScript API: http://help.ecwid.com/customer/porta...javascript-api

Hope this helps!
The Following User Says Thank You to enot For This Useful Post:
Heimatstcke Shop (09-23-2015)