Forums / Setting Up Categories, Products, Attributes / How-To: Add new Properties to your Products

How-To: Add new Properties to your Products

Views: 144,143

Results 261 to 272 of 272
29 Aug 2017, 1:21 AM
#261
mcs_computers avatar

mcs_computers

Zen Follower

Join Date:
Aug 2013
Location:
Bridlington
Posts:
151
Plugin Contributions:
0

How-To: Add new Properties to your Products

Okay its 2.17am and it`s time for bed.

Spent the last 30 mins or so looking at logs and rectifying the errors where I had put a , after all the ink_ml

Also the last file to edit was not the one in the default template but the RSB folder.

We now have 99% success, here is the data exactly where I want it ..

Attachment 17255

Problem is in step 3 rather than using Guarantee (In Months) I put Ink Or Toner Capacity but nothing is showing only a 6 that is coming from the database ??

29 Aug 2017, 11:57 AM
#262
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: How-To: Add new Properties to your Products

Generally speaking for "home use" (meaning unless there is a specifically considered reason), it is wise never to modify the template_default files. They are a stock, backup set of files that if they do not exist in a template override then they will be used. Take the statement with a heavy grain of salt, but there are a number of benefits of not editing the file(s) that are in there, doesn't mean can't add to those files or anything else, just a benefit to leave them be. How else will you be able to compare operation of the current template to a fully functional one?

As to the display, steps 3 and say 7 or 8 are completely distinct and unrelated. The original instructions were primarily about how to get the data to and from the database. There is additional language work to be done in the tpl_product_info_default.php file and associated includes/languages directory to make your addition more language friendly if you happen to go multi-language.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

29 Aug 2017, 12:37 PM
#263
mcs_computers avatar

mcs_computers

Zen Follower

Join Date:
Aug 2013
Location:
Bridlington
Posts:
151
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

Im not that bothered about multi language MC and all the steps followed have given me the result I required however that 6 on the pic above just sits there with no info what it is LOL, ideally I would want something like this ...

Attachment 17256

Other than that everything is working a treat. I was thinking there maybe a variation to step 8 to include the text before 6 fetched from the database.

29 Aug 2017, 1:07 PM
#264
mcs_computers avatar

mcs_computers

Zen Follower

Join Date:
Aug 2013
Location:
Bridlington
Posts:
151
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

Found a post on page 9 that covers my question, I must have missed that. Edit done and now working perfect. MC yet again your a star. I put 6ml in the product edit but it will not hold the ml part but Im assuming that's down to the database field Ill look into that but other than that perfect. Store is now ready to launch :) thanks again MC on this and all the other threads you`ve solved for me ;)

29 Aug 2017, 1:47 PM
#265
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: How-To: Add new Properties to your Products

MCS_Computers:

Found a post on page 9 that covers my question, I must have missed that. Edit done and now working perfect. MC yet again your a star. I put 6ml in the product edit but it will not hold the ml part but Im assuming that's down to the database field Ill look into that but other than that perfect. Store is now ready to launch :) thanks again MC on this and all the other threads you`ve solved for me ;)
Your field (ink_ml) is likely some numeric value like a float or an int, therefore the text ml will not get stored. Now, thing is, if you were able to add text before the value, you should be able to add text after it as well. Besides, why would you want to put something in a database field that is the same for every entry? What happens if one time you forget to add the ml? Then another, etc... if you're worried about displaying say 1,000 ml, then ok, might need something to help with that, but...

Welcome, glad you were able to find something of assistance. Trying to guide you to improvement as well as get your issues resolved.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

29 Aug 2017, 2:25 PM
#266
mcs_computers avatar

mcs_computers

Zen Follower

Join Date:
Aug 2013
Location:
Bridlington
Posts:
151
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

You were right, prior to your post I went into PHPMYADMIN and saw that the ink_ml field was infact set to int, I made the relevant changes and now everything works well.

I needed this entry because ink cartridges are done in ml and toners are done in page yield so I just needed to identify what the number meant so although the number changes for each product I either want ml if its an ink cartridge or Page Yield if it is a toner.

I already had a CSV that I imported with EP so all I did was added another column to the CSV with ml and page yield and with a little excel addon merged the 2 columns together.

Worked a treat, you have helped me understand so much more than I did a few weeks ago and have been very patient, for that I thank you MC ;)

8 Sep 2017, 12:18 AM
#267
foster660 avatar

foster660

New Zenner

Join Date:
Aug 2017
Location:
Wandong
Posts:
19
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

A big thank you to Chris for this tutorial... It's exactly what I've been trying to do in adding specific instructions for attributes and it works brilliantly!

In my mods, I've changed from an input field to a text area, which is working really well, but I'm looking to do some highlighting features (example below)

If I enter this - (edit- Sorry, what I've put below is NOT the code I'm using... it's an example of the data I put in. A bit confusing because I wrapped it in code tags)

<strong>Extra Attribute Info goes here</strong>

it saves it and shows it as this -

<strong>Extra Attribute Info goes here</strong>

The idea is to make any instructions prominent for customers to see with <strong>, <br>, <h7> and so on...

When entering into the "Products Description", I can use those elements where they work as expected, but not in the extra field I've put in...

I'm at a loss now so I'm asking for clues where I've gone wrong...
Thanks in advance
John

8 Sep 2017, 12:46 AM
#268
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: How-To: Add new Properties to your Products

Welcome to the new world of sanitization. ZC without knowing how the input is to be used, will "strip" such codes from the input for security sake as corrected for all of ZC 1.5.x here: https://www.zen-cart.com/showthread.php?219732-Trustwave-Security-report-Patch-Included-TWSL2016-006
With direction of how to apply sanitization for your input contained in the first post which directs to here: http://docs.zen-cart.com/Developer_Documentation/v1.5.5/code_docs/admin_sanitization

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

8 Sep 2017, 1:15 AM
#269
foster660 avatar

foster660

New Zenner

Join Date:
Aug 2017
Location:
Wandong
Posts:
19
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

That all makes sense now, thanks!

All I need to do is figure out how to use it... (with sanitizing disabled, everything works as I was expecting)

Thanks for your help, John

8 Sep 2017, 1:30 AM
#270
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: How-To: Add new Properties to your Products

Foster660:

That all makes sense now, thanks!

All I need to do is figure out how to use it... (with sanitizing disabled, everything works as I was expecting)

Thanks for your help, John
Looks like that docs link has been "moved", the most directly applicable (to ZC 1.5.5) is: http://docs.zen-cart.com/Developer_Documentation/1.5.5/code_docs/admin_sanitization

Somewhat surprisingly, it's not too difficult to apply the desired sanitization once the regex stuff at the bottom is better understood (currently doesn't have "straight" words about what it allows/removes, just identifies the "code" of what it does).

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

8 Sep 2017, 1:38 AM
#271
foster660 avatar

foster660

New Zenner

Join Date:
Aug 2017
Location:
Wandong
Posts:
19
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

Looks like that docs link has been "moved", the most directly applicable (to ZC 1.5.5) is: http://docs.zen-cart.com/Developer_D...n_sanitization
Sorry, I meant to mention the link didn't work... I found it easy enough

Somewhat surprisingly, it's not too difficult to apply the desired sanitization once the regex stuff at the bottom is better understood (currently doesn't have "straight" words about what it allows/removes, just identifies the "code" of what it does).
At the moment, I'm playing around off-line, so it's quick and easy to disable it... I've also enabled logging and once I get my head around the instructions and what's in the logs, I should be able to nut it out

John

8 Sep 2017, 3:08 AM
#272
foster660 avatar

foster660

New Zenner

Join Date:
Aug 2017
Location:
Wandong
Posts:
19
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

I seem to have figured it out and as suggested, it was a pretty easy solution... I'll post this so it might help others trying the same idea.

In "init_sanitize.php" I added the code in red : (That's the variable I've been playing around with)

$group = array('products_description', 'products_info', 'coupon_desc', 'file_contents', 'categories_description', 'message_html', 'banners_html_text', 'pages_html_text', 'comments', 'products_options_comment');
$sanitizer->addSimpleSanitization('PRODUCT_DESC_REGEX', $group);

As for as I can see everything works perfect - Thanks for the assistance, it's much appreciated.

John