Do a search in the Tools ... Developers Tool Kit ... in the bottom input box for:
products_materials
select Admin then click SEARCH ...
Open a new tab in your browser, and do a search for:
products_technical
is anyone missing? :unsure:
Printable View
Do a search in the Tools ... Developers Tool Kit ... in the bottom input box for:
products_materials
select Admin then click SEARCH ...
Open a new tab in your browser, and do a search for:
products_technical
is anyone missing? :unsure:
Forgive my laziness, too many replies to read, but this appears to be a great fix to my dilemma. I am currently using "read only" attributes, which is a very painful process for creating new products.
If I move to this fix, what happens when an upgrade occurs? I could probably live with reapplying the fix if that is the only issue.
You would need to save any modified admin files, and compare, merge (if necessary), and reinstall them. The db changes should carry over.
Hi Linda
Thanks for the reply. I tried that ... (When I tried just Admin in the filter I got an error (No matching Configuration Keys were found ... product_materials) but when I tried Catalog/Admin the results came through) Does that mean something?
When I ran both of these through the developers tool, all the same files are there and I checked through the syntax and it all looks the same too. It just seems to be that one field (techical) that is misbehaving. Any other ideas that I can try?
Well, I am sure that I will be able to find a way around the problem. I am thinking about making the Technical details and Maintenance a downloadable file - if I can get Delia's Extra Fields module to work with the latest upgrade.
However, I don't like to be beaten and would like to find a solution if at all possible - I never know when I might need to use that field and at the moment Delia's mod won't work for me.
Many thanks again.
OH NO ..... MORE SNOW !!!! I don't believe it!!!! :jawdrop:
Gillian
This sounds like you are not quite using the Developers Tool Kit correctly ...
Very carefully ... do a search in the Tools ... Developers Tool Kit ... in the bottom input box for:
products_materials
select Admin in the dropdown then click the SEARCH button ...
Open a new tab in your browser, and do a search for:
products_technical
is anyone missing?
Hi
I tried it again ... very carefully ... same result. Could the problem be that I have renamed my Admin folder? It seems to work fine seraching the catalog but not searching the admin. When I put Admin in the dropdown, it says searching 0 files at the top.
Searching 0 files ... for: products_materials
Match Lines found: 0
Warning Error: No matching Configuration Keys were found ... products_materials
Whereas when I put Catalog/admin in the drop down, it searches 854 files .... so it seems like it is not finding my admin folders. The foldwes it retreives in this latter serach do not include any admin files. I tried renaming Admin back to Admin but this didn't work either.
Mmmmm .... don't know what to try next ... Any suggestions?
Thanks for your patience with me ....
Gillian
Still snowed in ... kids have now been off school for a week!!!
Test a search on the word:
the
and select Admin in the dropdown ... do things show up?
It sounds like your /admin directory could be missing files or have files out of date ...
The answer you are getting on your search is as if you picked NONE from the dropdown rather than Admin ...
Hi
I tried searching for "THE" but again 0 files were checked. So there is a problem with my files.
I have upgrades to 1.3.9h. How can I check which file or what data might be missing ... a winmerge check of 1.3.9h with what I have or an earlier version compared to what I have?
Any idea which files control the developers tool function? I saw the one called developers_tool_kit.php but are there others?
All the best
Gillian
I use Beyond Compare from scootersoftware.com and that lets me compare all the files of a clean Zen Cart with a copy of my files on the server ...
If you own it, you can do FTP compares direct to the server ...
Hi Ajeh
Thanks for all your help.
I got the developers tool kit to work by ensuring that the ADMIN folder was renamed in all the Configure files. I then did what you suggested and compared the "products_technical" with other fields that were working and discovered that a missing letter N was the culprit!!! It is now working well.
Now, on to the problem of invalid master category ID which is appearing on one or two products and not allowingany of the data from the database to show up.
Thanks
Gillian
When trying to add the the info from the product admin page I keep getting a white screen. The boxes are showing up to add my info. When I add it I will click preview. It doesnt show in there and then if I click update it just goes to a white screen.
Can someone help with this?
Thanks,
Keith
Personally, I don't. It makes the code more complex (and hence more error-prone) and leads to poor structure. It also adds more overhead. If the Zen Project team write code that updates tables by using the VALUES (xxx, xxx, xxx, ...) syntax, then they are being silly. Their own code will end up breaking at some time. I suspect they use the much less error-prone "UPDATE table-name set col_x = 'xxxx', col_y = 'xxx' ...". I know I do -- it avoids having to go back and change code when the database schema changes. Note that separating your added columns into a separate table does not avoid this particular problem -- if you add another column to YOUR table, you can still break YOUR code unless you write your code to avoid the problem.
Tables should be kept as normalized as possible.
Guys i have a dumb question, I want to replace the word: "Model" with "Part #" where can i change that?
Thanks
Search for the word Model in the lang. files
tools>Developers Tool Kit > Language File Look-ups:
find the one for that particular output
Ive not seen this issue on a search so will post here in case its happened to someone else,
I have 3 new product fields setup which are all working correctly, but have noticed when trying to Duplicate a Product, the new fields show up as empty.
Can anyone advise what file I need to edit to enter this information to copy over.
Thanks very much
Sam
Does the module copy_to_confirm.php have your new fields in it? :unsure:
Thanks for the reply, ok ive messed about with the code a little on the copy_to_confirm but it is copying strange information over, replacing new field boxes with something completely different... for example I have 3 extra fields, none of the information actually gets copied, it takes it from another field (like model) depending where I place the extra fields this effects another fields data being copied, :wacko:
Any thought, much appreciated, thank you :)Quote:
} elseif ($_POST['copy_as'] == 'duplicate') {
$old_products_id = (int)$products_id;
$product = $db->Execute("select products_otherinfo, products_size, products_weight2, products_type, products_quantity, products_model, products_image,
products_price, products_virtual, products_date_available, products_weight,
products_tax_class_id, manufacturers_id,
products_quantity_order_min, products_quantity_order_units, products_priced_by_attribute,
product_is_free, product_is_call, products_quantity_mixed,
product_is_always_free_shipping, products_qty_box_status, products_quantity_order_max, products_sort_order,
products_price_sorter, master_categories_id
from " . TABLE_PRODUCTS . "
where products_id = '" . (int)$products_id . "'");
$tmp_value = zen_db_input($product->fields['products_quantity']);
$products_quantity = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$tmp_value = zen_db_input($product->fields['products_price']);
$products_price = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$tmp_value = zen_db_input($product->fields['products_weight']);
$products_weight = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$db->Execute("insert into " . TABLE_PRODUCTS . "
(products_otherinfo, products_size, products_weight2, products_type, products_quantity, products_model, products_image,
products_price, products_virtual, products_date_added, products_date_available,
products_weight, products_status, products_tax_class_id,
manufacturers_id,
products_quantity_order_min, products_quantity_order_units, products_priced_by_attribute,
product_is_free, product_is_call, products_quantity_mixed,
product_is_always_free_shipping, products_qty_box_status, products_quantity_order_max, products_sort_order,
products_price_sorter, master_categories_id
)
values ('" . zen_db_input($product->fields['products_type']) . "',
'" . $products_quantity . "',
'" . zen_db_input($product->fields['products_otherinfo']) . "',
'" . zen_db_input($product->fields['products_size']) . "',
'" . zen_db_input($product->fields['products_weight2']) . "',
'" . zen_db_input($product->fields['products_model']) . "',
'" . zen_db_input($product->fields['products_image']) . "',
'" . $products_price . "',
'" . zen_db_input($product->fields['products_virtual']) . "',
now(),
'" . (zen_not_null(zen_db_input($product->fields['products_date_available'])) ? zen_db_input($product->fields['products_date_available']) : '0001-01-01 00:00:00') . "',
'" . $products_weight . "', '0',
'" . (int)$product->fields['products_tax_class_id'] . "',
'" . (int)$product->fields['manufacturers_id'] . "',
'" . zen_db_input($product->fields['products_quantity_order_min']) . "',
'" . zen_db_input($product->fields['products_quantity_order_units']) . "',
'" . zen_db_input($product->fields['products_priced_by_attribute']) . "',
'" . (int)$product->fields['product_is_free'] . "',
'" . (int)$product->fields['product_is_call'] . "',
'" . (int)$product->fields['products_quantity_mixed'] . "',
'" . zen_db_input($product->fields['product_is_always_free_shipping']) . "',
'" . zen_db_input($product->fields['products_qty_box_status']) . "',
'" . zen_db_input($product->fields['products_quantity_order_max']) . "',
'" . zen_db_input($product->fields['products_sort_order']) . "',
'" . zen_db_input($product->fields['products_price_sorter']) . "',
'" . zen_db_input($categories_id) .
"')");
You are just sticking the new fields where ever ...
Put them on the end of the originals so that you are keeping everything in order ...
I've followed solution to add another product field, but in a separate table. Everything was fine unless I try to add new products via Easy Populate. However EP populates products to db but my additional table that holds custom field is not updated with new product_id. So if I go to a new product (inserted via EP) the page doesnt show any data because main query in main_template_vars.php breaks when trying to read product_id that doesnt exist in additional table.
I have ended creating trigger after insert which adds new product_id to the custom table, which is not elegant solution.
Hi everyone, i really interesting with this tips and I've finally finish that 8 steps. I success made 2 field and it appear on admin.
1.But when I finish add a new product, the new page appear and it says:
1054 Unknown column 'products_stock_lama' in 'field list'
in:
[insert into zen_products (products_quantity, products_type, products_model, products_price, products_date_available, products_weight, products_status, products_virtual, products_tax_class_id, manufacturers_id, products_quantity_order_min, products_quantity_order_units, products_priced_by_attribute, product_is_free, product_is_call, products_quantity_mixed, product_is_always_free_shipping, products_qty_box_status, products_quantity_order_max, products_sort_order, products_discount_type, products_discount_type_from, products_price_sorter, products_stock_lama, products_stock_baru, products_image, products_date_added, master_categories_id) values ('0', '1', '', '0', '2011-08-12', '0', '1', '0', '0', '0', '1', '1', '0', '0', '0', '1', '0', '1', '0', '0', '0', '0', '0', '15116129', '15116129', 'aaaaddd3.jpg', now(), '6')]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.
2.when i click the edit button for my product, the new page appear and :
1054 Unknown column 'p.products_stock_lama' in 'field list'
in:
[select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_virtual, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id, p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute, p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max, p.products_sort_order, p.products_discount_type, p.products_discount_type_from, p.products_price_sorter, p.master_categories_id, p.products_stock_lama, p.products_stock_baru from zen_products p, zen_products_description pd where p.products_id = '6' and p.products_id = pd.products_id and pd.language_id = '1']
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.
http://3.bp.########################...0/s1600/11.JPG
http://2.bp.########################...k/s1600/12.JPG
anyone, please help me . . . :cry:
I followed the instructions in the first post and was able to add several fields to my collect_info page and am able to display them on my site. No problems there.
Instead of the text entry fields on the collect_info page, I would like to use fckeditor. I got as far as getting the editor to display the correct info from the database but I can't get it to write to the database.
Does any one have any experience with this?
Thanks!
Here's the code related the the previous post:
************** this is the text field that reads and writes to the database. this works *******************
<td class="main"><?php echo Specifications; ?></td>
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '10') . ' ' .
zen_draw_input_field('products_specifications', $pInfo->products_specifications, 'size="100"', zen_set_field_length(TABLE_PRODUCTS, 'products_specifications')); ?></td>
</tr>
************** this is the fckeditor code that reads from the database, but won't update the database with any changes typed into it *******************
<tr>
<td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_SPECIFICATIONS; ?></td>
<td colspan="2"><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="main" width="25" valign="top"><?php echo zen_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>
<td class="main" width="100%">
<?php if ($_SESSION['html_editor_preference_status']=="FCKEDITOR") {
$oFCKeditor = new FCKeditor('products_specifications[' . $languages[$i]['id'] . ']') ;
$oFCKeditor->Value = (isset($products_specifications[$languages[$i]['id']])) ? stripslashes($products_specifications[$languages[$i]['id']]) : zen_get_products_specifications($pInfo->products_id, $languages[$i]['id']);
$oFCKeditor->Width = '99%' ;
$oFCKeditor->Height = '350' ;
// $oFCKeditor->Config['ToolbarLocation'] = 'Out:xToolbar' ;
// $oFCKeditor->Create() ;
$output = $oFCKeditor->CreateHtml() ; echo $output;
} else { // using HTMLAREA or just raw "source"
echo zen_draw_textarea_field('products_specifications[' . $languages[$i]['id'] . ']', 'soft', '100%', '30', (isset($products_specifications[$languages[$i]['id']])) ? htmlspecialchars(stripslashes($products_specifications[$languages[$i]['id']]), ENT_COMPAT, CHARSET, TRUE) : htmlspecialchars(zen_get_products_specifications($pInfo->products_id, $languages[$i]['id']), ENT_COMPAT, CHARSET, TRUE)); //,'id="'.'products_specifications' . $languages[$i]['id'] . '"');
} ?>
</td>
One other thing. I'd like to have 5 instances of fckeditor on the collect_info page.
Thanks!
Hi All,
I am now on this thread as I picked up on the above link, I have tried to implement this but while my custom fields will show on product display page using the above code, they will not behave in the same manner when using TPP, has anybody else had this, I'm spending so much time on this and just seem to be going around in circles???:wacko:
Hi All just to let ye know in case anyone comes across the same problem that I have got this sorted by using the following code allowed me to call in my custom fields for TPP:
$fmtDOT .= '<li>' .TEXT_PRODUCT_COUNT . $products_count .($product_info->fields['products_count']). "\n";
$fmtDOT .= '<li>' .TEXT_PRODUCT_UNIT_COST . $products_unit_cost .($product_info->fields['products_unit_cost']). "\n";
Sooo Happy, might have been a walk in the park for some but a mountain climbed for me!!!!:clap::clap::clap::clap::clap:
I have tried it and it works ~~~
But can anyone tell me how to add those new field and show in Product listing column and sort?
I have created quite a few fields which works perfectly, Thanks for this.
What I would like to do is put a couple of these entered fields into my product listings page.
Would I put the $product_info->fields['products_guarantee'] in my common/columnar_display file or my templates/product_listings page or some other page?
And if so where would I need to add SELECT p.products_guarantee... part in?
Any help would be appreciated.
Jay
Ok, so far I am think I need to add what I want in modules/product_listing.php but from what I have learnt in the past is that the modules files can be a little sensitive...
...so before I start to play around (obviously with a backup done:)) if anyone could save me a bit of time and point me in the right direction, that would greatly be appreciated.
So no-one knows?
Okay maybe this is going in the right direction but not to sure as its not working... so please if anyone knows what I am trying to do here and can see whats wrong, please feel free to jump in.
Here's what I have put in my includes/modules/MY_TEMPLATE/product_listing.php - (Only the bit in red, the rest is what's there.)
Code:$lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
$lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
$product_info = $db->Execute("select p.products_guarantee, p.products_color,
p.products_display, p.products_dimensions,
p.products_energy, p.products_spin, p.products_load,
p.products_frostfree, p.products_autodefrost,
p.products_fastfreeze, p.products_fridgecapacity,
p.products_fuel, p.products_lpgoption,
p.products_hob, p.products_elements,
p.products_cavities, p.products_oventype,
p.products_capacityone, p.products_capacitytwo
from " . TABLE_PRODUCTS . " p
where p.products_status = '1'
and p.products_id = '" . (int)$_GET['products_id'] . "'");
if (!empty($product_info->fields['products_guarantee'])) $lc_text .= '<b>Guarantee:<br /></b>' . ' ' . $product_info->fields['products_guarantee'];
break;
case 'PRODUCT_LIST_QUANTITY':
$lc_align = 'right';
$lc_text = $listing->fields['products_quantity'];
break;
Solution...
IF YOU WANT TO PLACE YOUR NEW FIELDS INTO YOUR PRODUCT LISTING.
-here's how...
1. Open includes/modules/product_listing.php
2. Add the code in 'Red', the 'Black' code just shows you where I placed mine 'Don't include it!'
3. Change 'product_guarantee' 'product_color' and 'product_dimensions' to your own names / table columns you have created.Code:$product_info = $db->Execute("select products_guarantee, products_color, products_dimensions
from " . TABLE_PRODUCTS . "
where products_status = '1'
and products_id = '" . (int)$listing->fields['products_id'] . "'");
if (!empty($product_info->fields['products_guarantee'])) $lc_text .= '<div class="productListFields">' . $product_info->fields['products_guarantee'] . '</div>';
if (!empty($product_info->fields['products_color'])) $lc_text .= '<div class="productListFields">' . $product_info->fields['products_color'] . '</div>';
if (!empty($product_info->fields['products_dimensions'])) $lc_text .= '<div class="productListFields">' . $product_info->fields['products_dimensions'] . '</div>';
break;
case 'PRODUCT_LIST_QUANTITY':
$lc_align = 'right';
$lc_text = $listing->fields['products_quantity'];
break;
That's it!
For styling purposes I have wrapped a <div> around each output with a class (productListFields) which you can remove or rename as you please for your stylesheet.
Well I hope this is beneficial to someone...
Jay.
There's a long thread here so apologies if its been said - but here's a thing - if its in a separate table then it is inaccessible using Apsona ShopAdmin as an import column. Therefore it should really be personal preference, as I now HAVE to add to the main db to get my clients old shop migrated (some fields are missing).
Great work - it saved my bacon! :flex:
I have been able to do everything successfully here. When I added the input field, it does change the value in the database (I checked in myPHP). The problem I am having is when I go back into edit the product, the value that is in the database for that field is not showing what the present value is, just a blank input field. I created a varchar field...I did all of the steps modifyin the collect_info, preview_info and update_product.php files. I did not need to show this on the product listing page as it is strictly a field I want to use when I print my invoices (fyi, each product is to have its own bin number and this will print on the invoice for order pickers).
Anyone know what may be happening, any help is much appreciated and what a great thread.
Sorry if this has been asked already, but I'm not scanning thru this whole thread. What I am wondering due to the fact I don't know php or Zen Cart that well, YET, but in the examples everywhere no one ever says exactly where the sort for "colour" is even coming from. I can't just make something up if it isn't an attribute or something. So my question, is do these extra fields draw from something that was created in the products such as attributes?
Extra fields are just that, extra. You only create them when the data you want to handle does not exist anywhere else in the product. If you can handle the data properly with attributes, you don't need an extra field.
Ok, I've read all 24 pages, and unless I overlooked a post, it seems that this modification is missing a change to the file that would be configuration>product listing
I did the mod as listed on the first post by crazy_chris. I have EP4 installed. I was able to import and export my csv text file with my extra fields.
The only thing left that I can see is to add the lines of code for the extra fields to the file/section that would add it to the configuration>product listing page in admin. Then I could assign sort order values to the extra fields and they *should* appear on the category and single product pages right?
If so, I need help finding that file, because I simply cannot find it (assuming I'm right).
I know this was said some time ago, but I am adding a custom field to the products and it needs to be textarea. I have tried the above but the data in the new cusotmfield is just been dropped.
Please could anyone advise what I am doing wrong? I have set up the product field as 'text' at mySQL
Sounds like you only updated collect_info.php and not also preview_info.php and update_product.php to know to save that data or where to put it.
Dr, I followed the step by step guide religiously and updated all the pages mentioned. The setup works when its written as an input field, but when I try to set this up as a text area, it disregards the data and nothing is listed.
I have read that maybe I should set up the new field (called technical Spec) as a separate database table, similar to how product_description is set up, but I don't know freely how to achieve this.
The syntax for zen_draw_textarea_field() is different than for zen_draw_input_field()
zen_draw_input_field($fieldname, $defaultValue)
vs
zen_draw_textarea_field($fieldname, 'soft', '100%', '5', $defaultValue)
where 'soft' should be left as 'soft'
'100%' is the width setting
'5' is the number of rows the field should display
So, you can't just change "input" to "textarea" unless you also change the parameters list.
Hi Doctor
I made the following change:
and adjusted the products_tinfo to the products table as 'text' and 'null' which for input was 'varchar (32)'Code:<?php echo zen_draw_textarea_field('products_tinfo[' . $languages[$i]['id'] . ']', 'soft', '100%', '10', $pInfo->products_tinfo, zen_set_field_length(TABLE_PRODUCTS, 'products_tinfo')); ?>
Apologies for the confusion. I did post all this info on a new thread which quite rightly, got removed (I was unsure if anyone would respond to a thread that was several years old). :blush:
It works!!! That was the issue.
Thankyou so much. :smile:
I know this is over 2 years old but here is my situation.
I'm running the latest Zen Cart and using the Responsive Sheffield Blue template.
I have successfully imported 10,000 products into my database of my new site and have it laid out well thanks to this community. I have used EP4 to import the data and have set my options in EP4 to include a user defined product field and I have imported the data I want to that field, that it working fine.
What I would like is to include this data (if possible) in the details tab like this ...
Attachment 17254
Obviously not in red LOL. After the : I would like it to get the data from the new field in the products table, the extra field is ink_ml and as said before already has the data relevant to the product.
I have followed this thread that was done back in 2015 by crazy_chris but ended up with an error on the product page so I`m not sure if anything has changed since that was written. Has anyone done a step by step guide to achieve this ??
Many thanks in advance to any help ;)
When the product was clicked all I got was a white screen with the word error at the top.
I went and checked I had put the code on correctly and made sure there was no spaces after the code, everything seemed to be in order, my first reaction was that maybe one of the files had been taken over by the theme.
Thought this had been provided previously in another thread related to a different issue, but follow the below instructions when presented with a blank screen or partial blank screen. Even if the issue is a little different than that, you can expect to find assistance in following it: http://www.zen-cart.com/content.php?124-blank-page
Hey MC
I'm in the process of starting again. I have followed steps 1 to 6 and there are no errors. About to finish with 7 and 8 so we will see what happens before looking at the link :)
Ok, step 7 which reads ...
At this point when I click a product I get the outer page displaying but the centre of the page where the product and info site I ts just white with the words WARNING: An Error occurred, please refresh the page and try again.Quote:
edit 'main_template_vars.php' (in /includes/modules/pages/product_info/)
around line 46 you find the variable $sql set. like in step 3.2 add the new rows with a 'p.' in front just before the 'from'
select ......., p.products_guarantee, p.products_color from ....
Could you clarify, the field in my database is called ink_ml and the file I`m asked to edit looks like this ...
$sql = "select p.products_id, pd.products_name,
pd.products_description, p.products_model,
p.products_quantity, p.products_image,
pd.products_url, p.products_price,
p.products_tax_class_id, p.products_date_added,
p.products_date_available, p.manufacturers_id, p.products_quantity,
p.products_weight, p.products_priced_by_attribute, p.product_is_free,
p.products_qty_box_status,
p.products_quantity_order_max,
p.products_discount_type, p.products_discount_type_from, p.products_sort_order, p.products_price_sorter
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_status = '1'
and p.products_id = '" . (int)$_GET['products_id'] . "'
and pd.products_id = p.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
I have tried variations of the instruction and get the error each time ??
And how does it look with your edit when you follow the provided instruction?
Again also, the link provided would guide you to error logs where the issue is likely described.
As soon as I edit the main_template_vars.php I refresh my store, click on a product and then get the error. I will follow the link you provided to see if it can shed some light, just wanted to check I had put the code in right as its a little confusing instruction 7 to a newbie :(
Okay, after the edit I look at the log file as advised by the link you sent and this was the log, way above my head if I`m being honest ...
[29-Aug-2017 00:21:29 Europe/London] Request URI: /index.php?main_page=product_info&cPath=1_7&products_id=77556, IP address: 86.164.234.122
#1 trigger_error() called at [/home/mcsbrid/public_html/ukinks.co.uk/includes/classes/db/mysql/query_factory.php:167]
#2 queryFactory->show_error() called at [/home/mcsbrid/public_html/ukinks.co.uk/includes/classes/db/mysql/query_factory.php:139]
#3 queryFactory->set_error() called at [/home/mcsbrid/public_html/ukinks.co.uk/includes/classes/db/mysql/query_factory.php:266]
#4 queryFactory->Execute() called at [/home/mcsbrid/public_html/ukinks.co.uk/includes/modules/pages/product_info/main_template_vars.php:58]
#5 require(/home/mcsbrid/public_html/ukinks.co.uk/includes/modules/pages/product_info/main_template_vars.php) called at [/home/mcsbrid/public_html/ukinks.co.uk/includes/templates/responsive_sheffield_blue/common/tpl_main_page.php:251]
#6 require(/home/mcsbrid/public_html/ukinks.co.uk/includes/templates/responsive_sheffield_blue/common/tpl_main_page.php) called at [/home/mcsbrid/public_html/ukinks.co.uk/index.php:97]
[29-Aug-2017 00:21:29 Europe/London] PHP Fatal error: 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.ink_ml,
from products p, products_description pd
where ' at line 11 :: select p.products_id, pd.products_name,
pd.products_description, p.products_model,
p.products_quantity, p.products_image,
pd.products_url, p.products_price,
p.products_tax_class_id, p.products_date_added,
p.products_date_available, p.manufacturers_id, p.products_quantity,
p.products_weight, p.products_priced_by_attribute, p.product_is_free,
p.products_qty_box_status,
p.products_quantity_order_max,
p.products_discount_type, p.products_discount_type_from, p.products_sort_order, p.products_price_sorter
p.ink_ml,
from products p, products_description pd
where p.products_status = '1'
and p.products_id = '77556'
and pd.products_id = p.products_id
and pd.language_id = '1' ==> (as called by) /home/mcsbrid/public_html/ukinks.co.uk/includes/modules/pages/product_info/main_template_vars.php on line 58 <== in /home/mcsbrid/public_html/ukinks.co.uk/includes/classes/db/mysql/query_factory.php on line 167
Without sounding thick are you saying to do this ..
,p.ink_ml
Or are you saying put a comma at the end of the previous line like so ..
p.products_discount_type, p.products_discount_type_from, p.products_sort_order, p.products_price_sorter,
So the coding should be as follows ..
$sql = "select p.products_id, pd.products_name,
pd.products_description, p.products_model,
p.products_quantity, p.products_image,
pd.products_url, p.products_price,
p.products_tax_class_id, p.products_date_added,
p.products_date_available, p.manufacturers_id, p.products_quantity,
p.products_weight, p.products_priced_by_attribute, p.product_is_free,
p.products_qty_box_status,
p.products_quantity_order_max,
p.products_discount_type, p.products_discount_type_from, p.products_sort_order, p.products_price_sorter
,p.ink_ml
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_status = '1'
and p.products_id = '" . (int)$_GET['products_id'] . "'
and pd.products_id = p.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
Or
$sql = "select p.products_id, pd.products_name,
pd.products_description, p.products_model,
p.products_quantity, p.products_image,
pd.products_url, p.products_price,
p.products_tax_class_id, p.products_date_added,
p.products_date_available, p.manufacturers_id, p.products_quantity,
p.products_weight, p.products_priced_by_attribute, p.product_is_free,
p.products_qty_box_status,
p.products_quantity_order_max,
p.products_discount_type, p.products_discount_type_from, p.products_sort_order, p.products_price_sorter,
p.ink_ml
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_status = '1'
and p.products_id = '" . (int)$_GET['products_id'] . "'
and pd.products_id = p.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
Not thick. It's just clear that the construct of a select statement is unfamiliar.
Technically it doesn't matter which way; however, when the next upgrade is performed and if you use comparison software, it would be clearer what the change/difference is/was if all new information is on the same line rather than split among two of them. Meaning, I would suggest your first representation:
, p.ink_ml
MC yet again a great help, doing the change has stopped the error, final part is this, I have placed the final code here in step 7 but the data is not showing.
<!--bof Product details list -->
<?php if ( (($flag_show_product_info_model == 1 and $products_model != '') or ($flag_show_product_info_weight == 1 and $products_weight !=0) or ($flag_show_product_info_quantity == 1) or ($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name))) ) { ?>
<ul id="productDetailsList" class="floatingBox back">
<?php echo (($flag_show_product_info_model == 1 and $products_model !='') ? '<li>' . TEXT_PRODUCT_MODEL . $products_model . '</li>' : '') . "\n"; ?>
<?php echo (($flag_show_product_info_weight == 1 and $products_weight !=0) ? '<li>' . TEXT_PRODUCT_WEIGHT . $products_weight . TEXT_PRODUCT_WEIGHT_UNIT . '</li>' : '') . "\n"; ?>
<?php echo $product_info->fields['ink_ml']; ?>
<?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>' : '') . "\n"; ?>
<?php echo (($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name)) ? '<li>' . TEXT_PRODUCT_MANUFACTURER . $manufacturers_name . '</li>' : '') . "\n"; ?>
</ul>
<br class="clearBoth" />
<?php
}
?>
Have I placed it in the correct area or is it something more sinister ?
Yet the field is there in admin when I edit a product
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 ??
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.
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.
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 I`m assuming that's down to the database field I`ll 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.
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 ;)
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)
it saves it and shows it as this -Code:<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...Code:<strong>Extra Attribute Info goes here</strong>
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
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....d-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_D...n_sanitization
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_D...n_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).
Sorry, I meant to mention the link didn't work... I found it easy enoughQuote:
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
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 outQuote:
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).
John
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)
As for as I can see everything works perfect - Thanks for the assistance, it's much appreciated.Code:$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);
John