-
Ok, things are definitely getting stored in the database table but they are not being displayed on the individual product page.
I've added this to the template page:
Code:
<?php echo ((SHOW_PRODUCT_PRINT_INFO_KEY_FEATURES == '1' and !empty($key_features)) ? TEXT_PRODUCT_KEY_FEATURES . $key_features : ''); ?>
The end result shows:
Key Features: Object
"Key Features:" is correct but "Object" isn't. Instead I should be seeing the list of features I typed in.
Any ideas? I'm guessing I have something wrong in the main_template_vars file, since there is code for "$key_features" there too.
any help would be great!
thanks!
june
-
where do you define $key_features?
Chances are it's simply the object used to run a SQL SELECT statement? If so, you need to extract the data it SELECTed in order to display the real data.
-
here is where $key_features appears:
collect_info.php
Code:
elseif (zen_not_null($_POST)) {
$pInfo->objectInfo($_POST);
$products_name = $_POST['products_name'];
$products_description = $_POST['products_description'];
$products_url = $_POST['products_url'];
$key_features = $_POST['key_features_id'];
$author = $_POST['author_id'];
$isbn = $_POST['isbn_id'];
$pages = $_POST['pages_id'];
}
$key_features_array = array(array('id' => '', 'text' => TEXT_NONE));
$key_features = $db->Execute("select products_id, key_features_id
from " . TABLE_PRODUCT_PRINT_EXTRA . " order by key_features_id");
while (!$key_features->EOF) {
$key_features_array[] = array('id' => $key_features->fields['products_id'],
'text' => $key_features->fields['key_features_id']);
$key_features->MoveNext();
main_template_vars.php
Code:
$sql = "select * from " . TABLE_PRODUCT_PRINT_EXTRA . "
where key_features_id = '" . $print_extras->fields['key_features_id'] . "'";
$key_features = $db->Execute($sql);
Code:
$key_features = $product_info->fields['key_features_id'];
tpl_product_print_info_display.php
Code:
<h2 class="pageHeadingP">Key Features</h2>
<p><?php echo ((SHOW_PRODUCT_PRINT_INFO_KEY_FEATURES == '1' and !empty($key_features)) ? TEXT_PRODUCT_KEY_FEATURES . $key_features : ''); ?></p>
And I'm not sure what I've done but "Key Features:" is no longer displaying either.
Any idea of where I might have gone wrong? If you need more context for the code, just let me know. I'm not sure if any of the code above is where the info is actually "extracted." I'm still learning php.
thanks!
june
-
Darkwander,
Where you able to see how to change the fields that I had mentionsed?
Thanks
-
ok, so I'm trying to narrow down my problem. below is some code from tpl_product_print_info_display:
Code:
<?php echo (( SHOW_PRODUCT_RRINT_INFO_AUTHOR == '1' and !empty($author)) ? TEXT_PRODUCT_AUTHOR . $author : 'Something'); ?>
Right now "something" is the only thing that displays. So that means:
1. SHOW_PRODUCT_RRINT_INFO_AUTHOR is turned on
2. $author isn't empty
3. the broken pieces of code include TEXT_PRODUCT_AUTHOR and $author.
I'm kind of confused as to why it is not displaying either of those things in #3.
Any could someone tell me what "?" in the middle means?
thanks!
june
-
Sorry, most the stuff in my last post is wrong! I just learned that my code contains a compact if statement. I'm not use to writing if statements that way. So, "something" is displaying because one or both of the determing factors are false.
I isolated each determining factor and they are both false. eek!
When I echo $author alone it displays a "0"
When I echo TEXT_PRODUCT_AUTHOR alone it displays "Author:" (which is correct)
well, back to the drawing board. heh.
-june
-
I just discovered that its outputting the info for the first record in the table, no matter what product you are looking at. The first product in the table was a listing that was mostly empty...hence the "0"
I'll let you know when I figure out the rest of the problem. ;)
thanks!
june
-
I am trying to take out the "Units in Stock" out of my product pages. IN the Product - General type this can easly be done with the edit layout feature in the Admin section. However, there is not such features for the General- Book product type.
Is there a way to put all the layout attributes in the product - Book section or how do I take out the "Units in Stock" from showing up?
Thanks
-
Nevermind. I just figured out that that changing the main attributed from the Product - General carries over to the sub Categories.
Sorry for the post
-
Actually ... that is dependant on how a Product Type is designed.
A 100% true Product Type would have all of the settings that you see in Product General ... this allows the settings to be 100% unique per product type so you can configure all the little nuances of a Product Type separately from another Product Typs ... :)