insideorkut.com

Can people in my iContact mailing list see my questions?

Try iContact email marketing for free for 30 days. Click here to use coupon...

Get a free trial of iContact here. Click here for this special deal...
Quick question... Can people in my iContact mailing list see my questions? Many thanks for any answer or 2. My other question... I need help in modifying the appropriate code so that the product listings include checkboxes for new and old and their selection affects the existing category or manufacturer. I have added an "age" field within the products table and populated with "new", "refurbished", or "old." I want the user to be able to have the ability to view "new", "refurbished" and "used" and easily remove viewing the used product, for example, within a given category..

It appears the that the index.php file contains the query sections that need modification but I don't have the php knowledge to make this work. Can someone help?..

Comments (4)

You betcha! although you might wanna make sure and wait for another person to confirm it as I am not confident. Better yet, why don't you call the iContact guys because they can give you help better...

Comment #1

And now for the admin side. In admin/categories.php, find the following code near line 223:.

'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']),.

'manufacturers_id' => tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id']));.

And change those lines to:.

'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']),.

'manufacturers_id' => tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id']),.

'age' => tep_db_prepare_input($HTTP_POST_VARS['age']));.

Now find the following code near line 223:.

} elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {.

$product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from "TABLE_PRODUCTS" where products_id = '"(int)$products_id"'");.

And replace the last line of that with:.

$product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id, age from "TABLE_PRODUCTS" where products_id = '"(int)$products_id"'");.

Now find this line, two lines below the above code:.

Tep_db_query("insert into "TABLE_PRODUCTS" (products_quantity, products_model, products_image, products_price, products_date_added, products_date_available, products_weight, products_length, products_width, products_height, products_status, products_tax_class_id, manufacturers_id) values ('"tep_db_input($product['products_quantity'])"', '"tep_db_input($product['products_model'])"', '"tep_db_input($product['products_image'])"', '"tep_db_input($product['products_price'])"', now(), '"tep_db_input($product['products_date_available'])"', '"tep_db_input($product['products_weight'])"', '"tep_db_input($product['products_length'])"', '"tep_db_input($product['products_width'])"', '"tep_db_input($product['products_height'])"', '0', '"(int)$product['products_tax_class_id']"', '"(int)$product['manufacturers_id']"'"')");.

And replace it with this:.

Tep_db_query("insert into "TABLE_PRODUCTS" (products_quantity, products_model, products_image, products_price, products_date_added, products_date_available, products_weight, products_length, products_width, products_height, products_status, products_tax_class_id, manufacturers_id, age) values ('"tep_db_input($product['products_quantity'])"', '"tep_db_input($product['products_model'])"', '"tep_db_input($product['products_image'])"', '"tep_db_input($product['products_price'])"', now(), '"tep_db_input($product['products_date_available'])"', '"tep_db_input($product['products_weight'])"', '"tep_db_input($product['products_length'])"', '"tep_db_input($product['products_width'])"', '"tep_db_input($product['products_height'])"', '0', '"(int)$product['products_tax_class_id']"', '"(int)$product['manufacturers_id']"', '"(int)$product['age']"')");.

Next, find code that looks like this around line 372:.

'products_status' => '',.

'products_tax_class_id' => '',.

'manufacturers_id' => '');.

And replace it with this:.

'products_status' => '',.

'products_tax_class_id' => '',.

'manufacturers_id' => '',.

'age' => '');.

Now find the following a few lines below that:.

$product_query = tep_db_query("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_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 from "TABLE_PRODUCTS" p, "TABLE_PRODUCTS_DESCRIPTION" pd where p.products_id = '"(int)$HTTP_GET_VARS['pID']"' and p.products_id = pd.products_id and pd.language_id = '"(int)$languages_id"'");.

And replace it with this:.

$product_query = tep_db_query("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_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.age from "TABLE_PRODUCTS" p, "TABLE_PRODUCTS_DESCRIPTION" pd where p.products_id = '"(int)$HTTP_GET_VARS['pID']"' and p.products_id = pd.products_id and pd.language_id = '"(int)$languages_id"'");.

Now find this code around line 412:.

$languages = tep_get_languages();.

And paste the following just above it:.

// Age filter.

$ages_array = array (array ('id' => 'new', 'text' => TEXT_NEW),.

Array ('id' => 'refurb', 'text' => TEXT_REFURB),.

Array ('id' => 'used', 'text' => TEXT_USED).

);.

// End age filter.

Now find this code around line 510:.

<?php.

For ($i=0, $n=sizeof($languages); $i<$n; $i++) {.

?>.

<tr>.

<td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_NAME; ?></td>.

And paste this just above it:.

<?php.

// Age Filter.

?>.

<tr>.

<td class="main"><?php echo TEXT_PRODUCTS_AGE; ?></td>.

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15')' 'tep_draw_pull_down_menu('age', $ages_array, $pInfo->age); ?></td>.

</tr>.

<tr>.

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>.

</tr>.

That's all for this file. To finish it off, find the following in admin/includes/languages/english/categories.php near line 87:.

Define('TEXT_PRODUCTS_PRICE_GROSS', 'Products Price (Gross):');.

Define('TEXT_PRODUCTS_WEIGHT', 'Products Weight:');.

And add the following just below:.

// Age Filter.

Define('TEXT_NEW', 'New');.

Define('TEXT_REFURB', 'Refurbished');.

Define('TEXT_USED', 'Used');.

Define('TEXT_PRODUCTS_AGE', 'Products Age: ');.

// End Age Filter.

That should do it. Of course if you use other languages you will need to modify the language files for those similar to the English files I've modified..

I've tested this on a test site, but there may still be lurking bugs. Use with care. Please post any suggestions or comments..

Regards.

Jim..

Comment #2

Very nice, Jim. It's working just fine for me..

I've added the admin portion and while I do not get any errors when accessing the admin, I don't see what these admin changes did. Where should they show up?..

Comment #3

They show up in the Categories/Products admin when you are editing or adding a product. You should have a dropdown to assign the "age" to the product..

Regards.

Jim..

Comment #4

I have a question....

I select a manufacturer and from that manufacturer I have both new and used products. If I want to select only the new products it will display the new products from ALL manufacturers. What must be modified to work with the manufacturer drop-down?.

Thank you..

Comment #5


This question was taken from a support group/message board and re-posted here so others can learn from it.