We put together a tutorial on how to implement this feature without a module. Attached is a pdf with step by step instructions. We've used this feature with a couple websites and it works well so we wanted to share it with the community.
Announcement
Collapse
No announcement yet.
Edit Attributes on Basket
Collapse
X
-
Re: Edit Attributes on Basket
Brenan,
I followed the manual and got this to working. Just one little thing I want to know, is there any way to pre-populate those options from the choices that user filled when he added the product to cart. Right now, a POST request is all I can think about, is there any other way to get those values pre-filled ?
-
Re: Edit Attributes on Basket
Hit a wall again, not sure why, but l.settings:option:index variable keeps returning blank value. Is there any other way to keep track of option index or did I do something obviously wrong here ,
Code:<mvt:assign name="l.settings:pairstring" value="''" /> <mvt:foreach iterator="option" array="group:options"> <mvt:assign name="l.settings:pairstring" value="( l.settings:pairstring $ 'Product_Attributes[' $ l.settings:option:index $ ']:code=' $ l.settings:option:attr_code $ '&')" /> <mvt:if expr="l.settings:option:option_id"> <mvt:assign name="l.settings:pairstring" value="( l.settings:pairstring $ 'Product_Attributes[' $ l.settings:option:index $ ']:value=' $ l.settings:option:opt_prompt $ '&')" /> <mvt:elseif expr="NOT ISNULL l.settings:option:data"> <mvt:assign name="l.settings:pairstring" value="( l.settings:pairstring $ 'Product_Attributes[' $ l.settings:option:index $ ']:value=' $ l.settings:option:data $ '&')" /> <mvt:elseif expr="NOT ISNULL l.settings:option:data_logn"> <mvt:assign name="l.settings:pairstring" value="( l.settings:pairstring $ 'Product_Attributes[' $ l.settings:option:index $ ']:value=' $ l.settings:option:data_logn $ '&')" /> </mvt:if> </mvt:foreach>
Comment
-
Re: Edit Attributes on Basket
I don't believe l.settings:option:index is set in that array.
I think the issue is you're translate the options in the basket back into Attribute/Options of the products page. The basket page is not going to have the Product_Attribute index you need.
You may have to do something different. Instead of passing the name value pairs in the format Miva expects just pass the attribute code and value like this:
&mvt:option:attr_code;=&mvt:option:opt_code;
Then on your product attribute template check to see if those values are set and if they are, output the correct attribute as selected.
Comment
-
Re: Edit Attributes on Basket
I have this set up on a dev site. It used to work, and it did pull the pre-selected item options into the modal to be edited, (or so I thought). Now the modal opens with everything set to default values.
My main reason for abandoning this in the beginning was because I couldn't get it working if there were multiple items in the cart with attribute options.
Maybe one of the Miva core updates broke this function/procedure somehow? It did work as long as I had only one item in the cart with attributes.Last edited by Ron Frigon; 09-30-15, 03:18 PM.Ron Frigon
Jedi Webmaster Obi-Ron Kenobi
Comment
-
Re: Edit Attributes on Basket
Originally posted by Brennan View PostI don't believe l.settings:option:index is set in that array.
I think the issue is you're translate the options in the basket back into Attribute/Options of the products page. The basket page is not going to have the Product_Attribute index you need.
You may have to do something different. Instead of passing the name value pairs in the format Miva expects just pass the attribute code and value like this:
&mvt:option:attr_code;=&mvt:option:opt_code;
Then on your product attribute template check to see if those values are set and if they are, output the correct attribute as selected.
I'll try to create conditionals for &mvt:option:attr_code;=&mvt:option:opt_code; pairs in Attribute Template. Hoping I succeed this time.
Comment
-
Re: Edit Attributes on Basket
Brennan,
Hit a wall again,
When you said "Then on your product attribute template check to see if those values are set and if they are, output the correct attribute as selected." I thought that is going to be very easy, I just have to get the values set in GET parameters.
But, now, I'm not even able to get those values. Only method I know to receive GET/POST parameters is with g.Paramname, but how can I receive those parameters when they are getting set dynamically, I don't have access to their names in advance. I can't recall the method to receive this kind of request. Am I missing something ?
Is there anything I can do to receive all GET parameters in a single structure or array irrespective of their names?
Comment
-
Re: Edit Attributes on Basket
I think you need to set the name pairs when you call the 'edit basket' function.
So, for example (simplified)
<a href="~/merchant.mvc?Screen=EATP&Product_Code=fooballs&Att ribute=&mvt:attr:code;_&mvt:opt:code">Edit Attributes</a>
So, now, when you call the Edit Attribute function, you have a variable containing the attribute code and its selected option, so you can run conditionals like
<mvt:if expr="attribute_code EQ gettoken(g.attribute, '_', 1)">
<mvt:if expr="option_code EQ gettoken(g.attribute, '_', 2)">
(Sorry for potato code, busy morning.)Bruce Golub
Phosphor Media - "Your Success is our Business"
Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
phosphormedia.com
Comment
-
Re: Edit Attributes on Basket
Rajnishsi, overthinking is a common malady of software development :)Bruce Golub
Phosphor Media - "Your Success is our Business"
Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
phosphormedia.com
Comment
Comment