lightspeedretail / webstore

Web Store eCommerce solution for Lightspeed
http://www.lightspeedpos.com/webstore
Open Software License 3.0
85 stars 63 forks source link

Bringing services over to a Wordpress blog? #558

Closed aethant closed 11 years ago

aethant commented 11 years ago

Sorry if this is a bit long winded...

I'm working on incorporating features of the web store into my Wordpress site. Both are hosted on the same server. I'm able to pull a few things over - for example, I can get the cart to come over by requiring prepend.inc.php in my Wordpress header file, and I can add to that cart by using a custom controller, as described in the wiki entry here.

However - I'm getting some errors that are hard to debug when working with individual product pages. For instance, I have a single product being shown. It's wrapped in a form with "xlsws_product" as the ID and the products code - a unique URL - as the action. The hidden form elements with a unique form ID (seems like a time&date stamp and some alphanumeric string - probably an MD5 of the product url) are there as well. I've also initiated the qc object in a script, as is done on the site itself, and created an array of form controls to that object, as, again, it appears to do inside of the webstore.

My challenge is the logic behind when someone selects a color or size. Typically, it would, as I understand it, go to the database and cross-reference that selection with the other option(s), essentially run over the matrix. If a size 2 isn't in blue, it removes blue from the color list, and so on.

Despite my other efforts, a TypeError is thrown when the user changes one of these options:

TypeError: 'undefined' is not an object (evaluating 'objForm.Qform__FormControl.value = strControl')

on line 225 of post.js

Prior to that line, the various strings that are set contain the proper values (form ID, action, so on) and the objForm object,when debugged, contains the contents of the form. However, as soon it gets to that line, it says objForm is undefined. objForm is created by getElementbyID with the form id (xlsws_product). I'm not seeing where or how it gets associated with Qform.

I'll admit I know very little of Qcodo, other than that LightSpeed is really making me hate it. :)

Any suggestions or assistance would really be appreciated.