Announcement
Collapse
No announcement yet.
writing product custom field isn't working. what am i doing wrong?
Collapse
X
-
I can attest to the fact that the code above works...have used it before.
Leave a comment:
-
what I really need is to just delete it all together. I saw some posts by brennan but i'm still not 100% sure if... when you write an empty value like g.thisIsNull to a product custom field does miva delete it from the product custom field table?
I see by playing with the store admin that is how the admin for product custom fields works. I need to emulate that to set and remove a custom field value by what category products belong to.
(the product flags in the levels readytheme). I have bestsellers (HOT), new, and sale flags. I am wanting to automate the flags, to speed up data entry on thousands of products.
Leave a comment:
-
This maybe what Kent and Scott where getting at, but you might want:
<mvt:assign name="g.thisIsNull" value="''"/>
and then
<mvt:item name="customfields" param="Write_Product_ID( l.settings:record:id, 'product_flag', g.thisIsNull)" />
Leave a comment:
-
Um, ya, I think Kent has it right. I suggest doing a "read_ " after the IF block to check for the change in 'product_flag.'
Scott
Leave a comment:
-
Off the top of my head, a positive value may need to be present to write to the field. A quick idea to try (if you haven't already): two actually, use a space in between the single quotes or use ascii code expression for the 'space' instead of the literal. If that doesn't work, does writing anything to that field work in this snippet?
Scott
Leave a comment:
-
As written, this will change the value of the custom field in the DB, but it won't change the value of the variable, l.settings:record:customfield:product_flag. You'll need a second mvt:assign to do that. Also, I don't know exactly what you've stored in "record;" maybe the :id value is not the same as the product ID?
Leave a comment:
-
writing product custom field isn't working. what am i doing wrong?
I have this inside a loop of products that reside in the array named record.
I get output for &mvt:record:id; and &mvt:record:code so i know my loop is working.
Also I get &mvt:record:customfield:product_flag; and it definitely outputs SALE
I checked by looking in the database and the contents of the product_flag is SALE no spaces before or after or anything like that.
What I am trying to do is unset sale to be null.
I can't seem to get rid of SALE on these products. I have tried Write_Product_Id and also Write_Product_Code
Code:<mvt:if expr="(l.settings:record:customfield:product_flag EQ 'SALE')"> <BR>- SALE FLAG YES --- code: &mvt:record:code; (&mvt:record:id;)flag: &mvt:record:customfield:product_flag;<BR> <mvt:comment>remove sale flag </mvt:comment> <mvt:item name="customfields" param="Write_Product_ID( l.settings:record:id, 'product_flag', '')" /> <mvt:else> . </mvt:if>
Last edited by kayakbabe; 09-01-18, 06:17 PM.Tags: None
Leave a comment: