Hi all, does anyone know how to hide an item optio...
# suitecommerce
e
Hi all, does anyone know how to hide an item option/ custom column field on the PDP in SCA 2019?
s
For what reason?
m
Hi @eminero you can do it on the configuration record, go to Shopping Catalog -> Item Options, and then check the “SHOW ONLY ITEMS LISTED IN: ITEM OPTIONS AND CUSTOM TRANSACTION COLUMN FIELDS” and on the bottom of the screen you need to configure all options that you want to show on the PDP.
e
Hi @Steve Goldberg and @Martin the thing is that they appear on the cart and checkout, I am setting those values in the backend, however I do not want them to be displayed on the PDP, because the customer is not allow to enter values for those fields. so I was wondering, is is possible to create an empty template in order to hide them? or another approach
I do need them to be displayed on the cart and checkout
m
Yes you can create an empty template and use the configuration record
You have the Selector Template that is the one used for the PDP
And the Selected Template that is the one used on Cart and Checkout
If you do that, there’s no need to check the checkbox that i mentioned before
s
That's a pretty clever way of doing it. I was just going to suggest running
jQuery('#custcol_gen_size-container').remove()
in an extension 😅
m
haha or in a CMS Area
e
Thanks guys! just another question, I create the empty template, then deploy, and after that, should this appear on the selector template?
s
Good question. I'm pretty sure you'd need to edit the config record schema https://developers.suitecommerce.com/section4750012866
see "add a new default option to an array"
and refer to ProductViews.ItemOptions.json for the property paths
e
Thanks @Steve Goldberg I will let you know how it goes!
s
yeah let me know, might make a cool blog post
e
That sounds great!
Hey @Steve Goldberg and @Martin the empty template solution works! but it involves a few extra steps, you need to override the ProdutViews.js script in which you need to add as a dependecy your new empty template and add to an array of objects as well. I think the idea for a blog post for this is necessary.
s
@eminero Thanks, I've spent a bit of time looking at this and I'm inclined to agree that you may be right about the ProductViews editing, which is a bit worrying. Can you tell me which parts of the file you edited?
e
Untitled
@Steve Goldberg besides to include the empty template as a dependency, I just added it to this array, then if this was setup in the configuration record, this is assigned for that item option
You do not need to edit anything else in the logic, you just need to include the empty template
s
OK TFI.
e
Let me know if this is a right solution, I think is not so bad to override that file but I may be wrong.
s
I think this shouldn't be necessary
But that is what I am trying to find out. I hit a brick wall myself so wanted to see how you did it.
e
I got it, let me know if you need more details since I created a Configuration file as well in order to include the new array option for the empty template
s
Thanks. I already created a new config file to add in the new option to the config record, along with the empty template, but when I try to use it it doesn't work. I tell it to use my special template, but it just ignores it and uses the default instead. When I change the default to my empty template, I just get a white screen on my PDPs and it fails to load 😂
So I'm just wondering if I really need to edit/override that JS file
e
yeah it happened to me as well, so I solved that overriding that file, if you put a debug on that file and follow the logic, you will notice that it never finds your new template since it is missing in the array of selector I put above.
s
Yup. That's what I thought.