chrometweaks.org

Is there any free website iPage hosting service provider in Pakistan ?

Click Here To View All Answers...


First question I got is Is there any free website iPage hosting service provider in Pakistan ? Many thanks for any response. Second question of mine... Hi all,.

Can anybody modify "new product infobox" become "new category infobox"?.

I need it. Please help me..

Thx all...

Comments (108)

Yup, however you might wanna make sure and wait for another person here to confirm it as I am not quite sure. Better yet, why don't you email the iPage guys because they can give you an answer better...

Comment #1

Hi, I have similar problem withe the content of such a box. I want to put product from current category in the box in the right column. So, if you read info about one specific product, you can see small images of the other products from the same category in the right column..

I have checked all contributions, but I couldynt find enything (it is not the Famili Product, and Featured Product). It should be few lines of code in the catalog/includes/box/xxxx.php..

Could you help me?..

Comment #2

Both of these ideas can be done. It's probably more than a few lines of code, though. I have some ideas along this line. I'll go look at the code and see what I can do..

Regards.

Jim..

Comment #3

Ayumi, here's your "new category infobox". It works the same as the New Products box, just for categories. Instructions are in the top of the code..

<?php.

/*.

 $Id: whats_new_categories.php,v 1.0 2004/06/06 jck Exp $.

   Based on whats_new.php,v 1.31 by hpdl.

 osCommerce, Open Source E-Commerce Solutions.

 http://www.oscommerce.com.

 Copyright (c) 2004 osCommerce.

 Released under the GNU General Public License.

*/.

/*.

 To use, copy this file into <catalog>/includes/boxes/whats_new_categories.php.

   then call it by copying the following line into <catalog>/includes/column_left.php.

   or <catalog>/includes/column_right.php at the point where you want it to appear:.

 .

   require(DIR_WS_BOXES'whats_new_category.php');.

 .

 This file was designed to replace the whats_new.php. If you want to use both, you.

   will need to change BOX_HEADING_WHATS_NEW in line 88 to BOX_HEADING_WHATS_NEW_CATEGORIES.

   then define that in <catalog>/includes/<language>.php.

*/.

// Test whether the selected category has a parent.

 function tep_has_parent($category) {.

   $category_query = tep_db_query("select parent_id.

                                   from "TABLE_CATEGORIES".

                                   where categories_id = '"(int)$category"'".

                                 );.

   if (tep_db_num_rows($category_query) > 0) {.

     $category = tep_db_fetch_array($category_query);.

     if (($category['parent_id'] == '0') || ($category['parent_id'] == '')) {.

    return false;.

  } else {.

    return true;.

  }.

   }.

 }.

// Build the path to the selected category.

 function build_cpath($category='') {.

   if (tep_has_parent($category)) {.

  $path = $category;.

     while(tep_has_parent($category)){.

       $category_query = tep_db_query("select parent_id.

                                       from "TABLE_CATEGORIES".

                                       where categories_id = '"(int)$category"'".

                                     );.

       if (tep_db_num_rows($category_query) > 0) {.

         $category_array = tep_db_fetch_array($category_query);.

   $category = $category_array['parent_id'];.

      $path = $category'_'$path;.

       }.

     }.

   } else {.

     $path = $category;.

   }.

   return $path;.

 }.

// Select a random category.

 if ($random_category = tep_random_select("select c.categories_id,.

                                                  c.categories_image,.

                                                  cd.categories_name.

                                           from "TABLE_CATEGORIES" c,  .

                                                "TABLE_CATEGORIES_DESCRIPTION" cd  .

                                           where c.categories_id = cd.categories_id.

                                             and cd.language_id = "$languages_id".

                                           order by c.date_added desc.

                                           limit "MAX_RANDOM_SELECT_NEW.

                                  )) {.

// Automatically size the category images.

   $image_size = getimagesize(DIR_WS_IMAGES$random_category['categories_image']);.

   $image_width = $image_size[0];.

   $image_height = $image_size[1];.

?>.

<! whats_new_categories //>.

         <tr>.

           <td>.

<?php.

   $info_box_contents = array();.

   $info_box_contents[] = array('text' => BOX_HEADING_WHATS_NEW);.

   new infoBoxHeading($info_box_contents, false, false);.

   $info_box_contents = array();.

   $info_box_contents[] = array('align' => 'center',.

                                'text' => '<a href="'tep_href_link(FILENAME_DEFAULT, 'cPath='.

                   build_cpath($random_category['categories_id']))'">'.

         tep_image(DIR_WS_IMAGES$random_category['categories_image'], $random_category['categories_name'], $image_width, $image_height).

                                          '</a><br><a href="'tep_href_link(FILENAME_DEFAULT, 'cPath='.

             build_cpath($random_category['categories_id']))'">'.

         $random_category['categories_name']'</a>'.

                               );.

   new infoBox($info_box_contents);.

?>.

           </td>.

         </tr>.

<! whats_new_categories_eof //>.

<?php.

 }.

?>.

I'm still working on the Similar Products box. I'll post it here whan I have it finished..

Regards.

Jim..

Comment #4

And here's the Similar Products box. This one is a bit more complicated, so I gave it an admin interface. First, run the following SQL commands on your database:.

INSERT INTO configuration VALUES (NULL, 'Show product name', 'SIMILAR_PRODUCTS_SHOW_NAME', 'true', 'Show the product name in the Similar Products box', 60, 10, '2004-06-06 17:29:09', '2004-06-06 16:10:31', NULL, 'tep_cfg_select_option(array(\'true\', \'false\'),');.

INSERT INTO configuration VALUES (NULL, 'Show product model', 'SIMILAR_PRODUCTS_SHOW_MODEL', 'true', 'Show the product model number in the Similar Products box', 60, 20, '2004-06-06 17:29:14', '2004-06-06 16:10:31', NULL, 'tep_cfg_select_option(array(\'true\', \'false\'),');.

INSERT INTO configuration VALUES (NULL, 'Show product price', 'SIMILAR_PRODUCTS_SHOW_PRICE', 'true', 'Show the product price in the Similar Products box', 60, 30, '2004-06-06 16:10:31', '2004-06-06 16:10:31', NULL, 'tep_cfg_select_option(array(\'true\', \'false\'),');.

INSERT INTO configuration VALUES (NULL, 'No. of Similar Products', 'MAX_SIMILAR_PRODUCTS', '5', 'Number of products to show in the Similar Products box', 60, 40, '2004-06-06 16:10:31', '2004-06-06 16:10:31', NULL, NULL);.

INSERT INTO configuration VALUES (NULL, 'Sort Similar Products', 'SIMILAR_PRODUCTS_ORDER', 'Random', 'Database field to sort the Similar Products by', 60, 50, '2004-06-06 17:28:49', '2004-06-06 16:10:31', NULL, 'tep_cfg_select_option(array(\'Random\', \'Products ID\', \'Model Number\', \'Price\', \'Date Added\', \' Last Modified\', \'Products Ordered\', \'Products Name\', \'Products Viewed\'),');.

INSERT INTO configuration VALUES (NULL, 'Sort Order', 'SIMILAR_PRODUCTS_SORT_ORDER', 'Ascending', 'Order in which to sort the Similar Products', 60, 60, '2004-06-06 17:27:42', '2004-06-06 16:10:31', NULL, 'tep_cfg_select_option(array(\'Ascending\', \'Descending\'),');.

Then, add the following lines to <catalog>/includes/languages/english.php:.

// Similar products box in includes/boxes/similar_products.php.

Define('BOX_HEADING_SIMILAR_PRODUCTS', 'Similar Products');.

Then, add the following lines to <catalog>/includes/column_left.php or <catalog>/includes/column_right.php, at the location where you want your box to appear:.

//  Show the Similar Products box if we are on a product page.

 if (isset($_GET['products_id'])) include(DIR_WS_BOXES'similar_products.php');.

Last, save the following code as <catalog>/includes/boxes/similar_products.php.

<?php.

/*.

 $Id: similar_products.php,v 1.0 2004/06/06 jck Exp $.

   Based on whats_new.php,v 1.31 by hpdl.

 osCommerce, Open Source E-Commerce Solutions.

 http://www.oscommerce.com.

 Copyright (c) 2004 osCommerce.

 Released under the GNU General Public License.

*/.

// Set the sort order for the display.

 switch(SIMILAR_PRODUCTS_ORDER){.

   case 'Random':.

     $sort_order = 'RAND() ';.

     break;.

   case 'Products ID':.

     $sort_order = 'p.products_id ';.

     break;.

   case 'Model Number':.

     $sort_order = 'p.products_model ';.

     break;.

   case 'Price':.

     $sort_order = 'p.products_price ';.

     break;.

   case 'Date Added':.

     $sort_order = 'p.products_date_added ';.

     break;.

   case 'Last Modified':.

     $sort_order = 'p.products_last_modified ';.

     break;.

   case 'Products Ordered':.

     $sort_order = 'p.products_ordered ';.

     break;.

   case 'Products Name':.

     $sort_order = 'pd.products_name ';.

     break;.

   case 'Products Viewed':.

     $sort_order = 'pd.products_viewed ';.

     break;.

   default:.

     $sort_order = 'RAND() ';.

 } // switch.

 switch(SIMILAR_PRODUCTS_SORT_ORDER){.

   case 'Ascending':.

     $sort_order .= 'asc';.

     break;.

   case 'Descending':.

     $sort_order .= 'desc';.

     break;.

   default:.

     $sort_order .= 'asc';.

 } // switch.

// Find the id # of the category that the current product is in.

   $category_query = tep_db_query("select categories_id.

                                from "TABLE_PRODUCTS_TO_CATEGORIES".

       where products_id = '"(int)$_GET['products_id']"'".

                                 );.

   $category = tep_db_fetch_array($category_query);.

   $category_id = $category['categories_id'];.

// Select the other products in the same category.

   $products_query = tep_db_query("select p.products_id,.

                                          p.products_image,.

                                          p.products_price,.

                                          p.products_model,.

                                          pd.products_name.

                                   from "TABLE_PRODUCTS" p,  .

                                        "TABLE_PRODUCTS_DESCRIPTION" pd,  .

                                        "TABLE_PRODUCTS_TO_CATEGORIES" pc  .

                                   where p.products_id = pc.products_id.

                                     and p.products_id = pd.products_id.

                                     and p.products_id != '"(int)$_GET['products_id']"'.

                                     and p.products_status = '1'.

                                     and pc.categories_id = '"(int)$category_id"'.

                                     and pd.language_id = '"(int)$languages_id"'.

                                   order by "$sort_order".

                                   limit "MAX_SIMILAR_PRODUCTS.

                                 );.

// Write the output containing each of the products.

   $products_string = '';.

   $count_products = 0;.

   while ($products = tep_db_fetch_array($products_query)) {.

  if ($products['products_id'] != $_GET['products_id']) {.

       $products_string .= '<a href="'tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='$products['products_id'])'">';.

       $products_string .= tep_image(DIR_WS_IMAGES$products['products_image'], $products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);.

       $products_string .= '</a><br><a href="'tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='$products['products_id'])'">';.

       if (SIMILAR_PRODUCTS_SHOW_MODEL == 'true' && tep_not_null($products['products_model'])) {.

         $products_string .= $products['products_model']'<br>';.

       }.

       if ((SIMILAR_PRODUCTS_SHOW_NAME == 'true') && tep_not_null($products['products_name'])) {.

         $products_string .= $products['products_name']'<br>';.

       }.

       if (SIMILAR_PRODUCTS_SHOW_PRICE == 'true') {.

         $products_string .= $currencies->display_price($products['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']))'<br>';.

       }.

       $products_string .= '</a><br>';.

       $count_products++;.

  }.

   }.

   .

?>.

<! similar_products //>.

         <tr>.

           <td>.

<?php.

   $info_box_contents = array();.

   $info_box_contents[] = array('text' => BOX_HEADING_SIMILAR_PRODUCTS);.

   new infoBoxHeading($info_box_contents, false, false);.

   $info_box_contents = array();.

   $info_box_contents[] = array('align' => 'center',.

                                 'text' => $products_string.

                               );.

   new infoBox($info_box_contents);.

?>.

           </td>.

         </tr>.

<! similar_products_eof //>.

To change the appearance of this box, change the settings in Admin > Configuration > Similar Products. If you find any errors or problems with this code, please post them here. I'll be working on contributions for both of these..

Regards.

Jim..

Comment #5

And the Similar Products Box has been posted as a.

Contribution.

..

Regards.

Jim..

Comment #6

The program works fine for me, it's just when I want to change the Configuration I click on Admin panel, click on Configuration, then click on Similar Products in the box on the left, but it does not display anything in here. If I go via myphpadmin I can change the values so they are there?.

Any help, thanks..

Comment #7

It sounds like the new lines didn't get added to the configuration table. Check (using phpMyAdmin) that the six new lines were added. There should also be one new line added to the configuration_group table, but that appears to be there. Did you make any changes to the configuration.sql before you ran it? Have you made any other mods that involve changes to the configuration table?.

Regards.

Jim..

Comment #8

This is in configuration.

16 Show Category Counts SHOW_COUNTS true Count recursively how many products are in each category 1 19 NULL 2004-06-09 00:24:11 NULL tep_cfg_select_option(array('true', 'false'),.

This is in configuration_group.

16 Similar Products Contents of the Similar Products box 99 1.

I think this is correct?..

Comment #9

The line added to Configuration Group is correct. The line you show from the Configuration table is not a part of this contribution. There should be six lines added to this table. Look at the first six lines in the configuration.sql file in this contribution to see what they should be..

Regards.

Jim..

Comment #10

Hi all,.

Can anybody modify "new product infobox" become "new category infobox"?.

I need it. Please help me..

Thx all...

Comment #11

Do you mean the title or do you mean for it to show catagories instead of products..

If title then in catalog/includes/languages/english/index.php locate this code.

Define('TABLE_HEADING_NEW_PRODUCTS', 'New Products For %s');.

Change it to this.

Define('TABLE_HEADING_NEW_PRODUCTS', 'New Categories For %s');.

Do not use the online file manager for the edit as there are known issues with the file manager stripping backslashes from the code which will result in a parse error, instead use an ftp program such as ws_ftp to donload the file, edit offline and ftp upload to the server..

Comment #12


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