Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Help with converting simple mod to Zen Cart please!!!!!!!!!!!!!!

Help with converting simple mod to Zen Cart please!!!!!!!!!!!!!!

Locked

Views: 1,378

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
11 Feb 2008, 10:31 PM
#1
fightthefourwalls avatar

fightthefourwalls

New Zenner

Join Date:
Nov 2007
Posts:
57
Plugin Contributions:
0

Help with converting simple mod to Zen Cart please!!!!!!!!!!!!!!

Hi all

Anyone who knows some of the Zen language can you please help me convert this simple mod from OsCommerce: addons.oscommerce.com/info/5351.

Here is the OsCommerce Mod:

"=======================================================================
Show all products in category mod V1.01 11/11/2007

This is a very simple modification to osCommerce 2.2 MS2. Once this modification is installed the products will be listed similar to the product listing page for the selected category, including all products in the subcategories. You will not see the individual subcategory selections for each category.

The product listing results displayed can be refined by shoppers by clicking down through the category tree already present in your category box.

All credit goes to itsover who posted this in the forums, I've just tweaked it a little and presented it as a contrib.

I've included a generic screen shot so you can see the results before installing.

Dont forget to backup first, its only one file.

All line numbers are estimates based on your previous modifications to the file.

*8/26/2007= Update to 8/10 release with bug fix to show product listing options.
*11/11/2007= Update to fix bug so the same item in multiple subcategories is only displayed once.
Update to fix breadcrumb bug.

=====================================================================

In catalog/index.php:

  1. Around line 20, replace

    if ($cateqories_products['total'] > 0) {
    $category_depth = 'products'; // display products
    } else {

with

if (tep_count_products_in_category($cPath) > 0) {
$category_depth = 'products'; // display products
} else {


  1. Around line 86, replace

CODE
// We show them all
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
}
}

with......

CODE
// We show them all
$cPathA = explode("_", $cPath);
$size = sizeof($cPathA)-1;
$subcategories_array = array();
zen_get_subcategories($subcategories_array, $cPathA[$size]);
$size_sc = sizeof($subcategories_array); //Subcat count
$cat_Search = "(";
for($i = 0; $i < $size_sc; $i++){
$cat_Search .= "p2c.categories_id = '" . $subcategories_array[$i] . "' or ";
}
$cat_Search .= "p2c.categories_id = '" . $cPathA[$size] . "'" . ")";

  $listing_sql = "select distinct" . $select_column_list . " p.products_image, pd.products_name, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and " . $cat_Search . "";
  }
}

  1. In includes/modules/product_listing.php, replace:

       case 'PRODUCT_LIST_NAME':
         $lc_align = '';
         if (isset($HTTP_GET_VARS['manufacturers_id'])) {
           $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . ' - ' . tep_get_category_name($listing['products_id']) . '</a> ';
         } else {
           $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . ' - ' . tep_get_category_name($listing['products_id']) . '</a> ';
         }
    

with.....

      case 'PRODUCT_LIST_NAME':
        $lc_align = '';
        if (isset($HTTP_GET_VARS['manufacturers_id'])) {
          $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . ' - ' . tep_get_category_name($listing['products_id']) . '</a> ';
        } else {
          $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . ' - ' . tep_get_category_name($listing['products_id']) . '</a> ';
        }

and also includes/modules/product_listing.php, replace:

      case 'PRODUCT_LIST_IMAGE':
        $lc_align = 'center';
        if (isset($HTTP_GET_VARS['manufacturers_id'])) {
          $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
        } else {
          $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
        }

with......

      case 'PRODUCT_LIST_IMAGE':
        $lc_align = 'center';
        if (isset($HTTP_GET_VARS['manufacturers_id'])) {
          $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
        } else {
          $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
        }

And thats it. "

I believe I have found the files that need slight modification:

Step 1 (OsCommerce's "catalog/index.php") refers to Zen Cart's "includes/modules/pages/index/header_php.php"
Step 2 (OsCommerce's "catalog/index.php") refers to Zen Cart's "includes/index_filters/default_filter.php"
Steps 3 & 4 (OsCommerce's "includes/modules/product_listing.php") refers ti Zen Cart's "includes/modules/product_listing.php".

I have found this article also regarding converting OsCommerce Mods into Zen Cart Mods: http://www.zenportali.com/index.php?option=com_content&task=view&id=35&Itemid=25

Any help would be much appreciated! I have tried various modifications to my code but have not had success yet. :(

Thanks a million!!! :clap:
Nick.

11 Feb 2008, 11:17 PM
#2
hem avatar

hem

Totally Zenned

Join Date:
Sep 2007
Location:
Dublin, Ireland
Posts:
1,281
Plugin Contributions:
5

Re: Help with converting simple mod to Zen Cart please!!!!!!!!!!!!!!

If you don't get any other replies I'll have a look in the morning.

13 Feb 2008, 12:20 AM
#3
fightthefourwalls avatar

fightthefourwalls

New Zenner

Join Date:
Nov 2007
Posts:
57
Plugin Contributions:
0

Re: Help with converting simple mod to Zen Cart please!!!!!!!!!!!!!!

Thanks mate will really appreciate it!!!

14 Feb 2008, 1:45 AM
#4
fightthefourwalls avatar

fightthefourwalls

New Zenner

Join Date:
Nov 2007
Posts:
57
Plugin Contributions:
0

Re: Help with converting simple mod to Zen Cart please!!!!!!!!!!!!!!

Anyone?!?... Please!!!!

14 Feb 2008, 8:56 AM
#5
hem avatar

hem

Totally Zenned

Join Date:
Sep 2007
Location:
Dublin, Ireland
Posts:
1,281
Plugin Contributions:
5

Re: Help with converting simple mod to Zen Cart please!!!!!!!!!!!!!!

I'm having a look at it. ZenCart has moved on a lot so it's not that easy to track down the changes. But I'll have a good go at it at the weekend.

15 Feb 2008, 2:13 AM
#6
fightthefourwalls avatar

fightthefourwalls

New Zenner

Join Date:
Nov 2007
Posts:
57
Plugin Contributions:
0

Re: Help with converting simple mod to Zen Cart please!!!!!!!!!!!!!!

Thanks heaps! I used the Developers Toolkit in my admin to look up the files and believe that the files are as follows for Zencart:

Step 1:
includes/modules/pages/index/header_php.php

Step 2:
includes/index_filters/default_filter.php

Step 3 & 4:
includes/modules/product_listing.php

Hope this helps!!! :smile:

24 Feb 2008, 10:46 PM
#7
fightthefourwalls avatar

fightthefourwalls

New Zenner

Join Date:
Nov 2007
Posts:
57
Plugin Contributions:
0

Re: Help with converting simple mod to Zen Cart please!!!!!!!!!!!!!!

Any help at all... I've been trying but still unsuccessful!