PDA

View Full Version : Featured Items Column Formatting


SatinRose
October 29th, 2003, 01:13 PM
I know I've asked this before, but I never got a response, so I'm asking again.

I did everything to add the featured items to the home page, but they're showing up in a row. If I try to adjust the table row and column this is supposed to show in, only the title of the column is affected.

www.satinroseintimates.com/store.php

Thanks!
Lindsay

Jamie
October 29th, 2003, 10:18 PM
Hi Lindsay,

The number of products that appear per row is controlled by the "Products_per_Row" field in your store settings. If you set this to 1, they would appear in a column. The problem is that this field is global, in that it controls the number of products per row for every category. We will be adding this same setting to the category records in the future to control it on a per category basis.

You could fix this with a hack to your squirrelcart/functions/show_products.func file. Open it up, and find the code starting at line 451, which looks like this:

// set things that are specific to new product preview OR regular product display
if ($mode == "new preview") {
$products_per_row = get_field_val("Store_Information","New_Products_per_Row");
$header_template = $SESSION['templates']['new_product_preview_header'];
$product_template = $SESSION['templates']['new_product_preview'];
$footer_template = $SESSION['templates']['new_product_preview_footer'];
$separator_template = $SESSION['templates']['new_product_preview_separator'];
$New_Category_Name = get_field_val("Categories","Name","record_number = '1'");
if ($number_of_records > 1) $More_Than_One_New_Item = 1;
} else {
$products_per_row = get_field_val("Store_Information","Products_per_Row");
$header_template = $SESSION['templates']['show_product_header'];
$product_template = $SESSION['templates']['show_product'];
$footer_template = $SESSION['templates']['show_product_footer'];
$separator_template = $SESSION['templates']['show_product_separator'];
}

// set things that are specific to new product preview OR regular product display
if ($mode == "new preview") {
$products_per_row = get_field_val("Store_Information","New_Products_per_Row");
$header_template = $SESSION['templates']['new_product_preview_header'];
$product_template = $SESSION['templates']['new_product_preview'];
$footer_template = $SESSION['templates']['new_product_preview_footer'];
$separator_template = $SESSION['templates']['new_product_preview_separator'];
$New_Category_Name = get_field_val("Categories","Name","record_number = '1'");
if ($number_of_records > 1) $More_Than_One_New_Item = 1;
} else {
if($crn == "X") {
$products_per_row = 1;
} else {
$products_per_row = get_field_val("Store_Information","Products_per_Row");
}
$header_template = $SESSION['templates']['show_product_header'];
$product_template = $SESSION['templates']['show_product'];
$footer_template = $SESSION['templates']['show_product_footer'];
$separator_template = $SESSION['templates']['show_product_separator'];
}


Change the X between the quotes to the record number of your featured items category. That should set the products per row to 1 for that category only.

Thanks,
Jamie

SatinRose
October 29th, 2003, 11:55 PM
Perfect!

Jamie, you're my hero!!

Jamie
October 30th, 2003, 08:28 AM
:squirrel:

SatinRose
October 30th, 2003, 01:03 PM
I hate to do this after I said 'perfect'...(you're still my hero)


The featured items is a column, but the title and the column are not in sync.

http://www.satinroseintimates.com/store.php

Why are these not lining up? How do I fix it? I've tried messing with window.php, store.php and home.php. Nothing works. I need it to be right justified.

Any ideas?

-Lindasy

Jamie
October 30th, 2003, 11:28 PM
Hi Lindsay,

If you are referring to the width of the featured items section, it can be fixed with a little more custom code. The section is appearing very wide because it is designed to be displayed in the main content section of the cart. The problem is with the template file "show_product_header.php". Copy it to your custom theme, and then change this line from:

<table class="product_display" border="0">

to:

<?
if ($crn != X) $class = "class=\"product_display\"";
?>
<table <?=class?> border="0">


Change the X above to the record_number from the featured items category. This will then only add the class to the table when the category is not your featured one.

-Jamie

SatinRose
October 31st, 2003, 01:12 AM
Hi Lindsay,

If you are referring to the width of the featured items section, it can be fixed with a little more custom code. The section is appearing very wide because it is designed to be displayed in the main content section of the cart. The problem is with the template file "show_product_header.php". Copy it to your custom theme, and then change this line from:

<table class="product_display" border="0">

to:

<?
if ($crn != X) $class = "class=\"product_display\"";
?>
<table <?=class?> border="0">


Change the X above to the record_number from the featured items category. This will then only add the class to the table when the category is not your featured one.

-Jamie

Hi Jamie, I did this and got the following error:

Parse error: parse error, expecting `','' or `';'' in /home/satinrose/www/squirrelcart/themes/brushed_steel/show_product_header.php on line 5

Is there a ; or something missing? (I'm not good enough at PHP to tell where it's supposed to be).

-Lindsay

Jamie
October 31st, 2003, 11:15 AM
The last line should have been:

<table <?=$class?> border="0">

I left off the dollar sign. See if that works for you.

Thanks,
Jamie

rightminddesign
August 9th, 2004, 01:04 PM
I have submitted a support ticket for this same question a couple of days ago, so I am happy to come across this reponse...however, I think I have a different version than this was intended for.

I am using version 1.4.0, and I do not see the show_functions.func file in the functions folder. What has this been changed to in the new version? And will the code supplied here still work?

Thanks to any who could point me in the right direction!
:)

Jamie
August 16th, 2004, 12:34 PM
Hi,

Sorry for the delay. I just spotted your post. That was a mistake. It should have read "show_products.func". I just updated the original post to fix the problem.

Thanks,
Jamie