Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribtion] Year/Make/Model for OSC v2.3.x


Guest

Recommended Posts

Dream Media - "make the contribution into a working contribution"

 

So is the latest YMMP contribute not working or is it just me.

Don't know if that last comment relates to the new post or a side project...

 

 

When I add fields to products they are not searchable by the box.

site example @ http://www.cheshirechoppers.com/catalog/product_info.php?cPath=55&products_id=234

 

Any help would be very much appreciated

Link to comment
Share on other sites

@@malenky

 

yes, it does work on a standard installation. If you have a modified store, you will have to modify the contribution to suit your needs.

 

Anyone having an issue with installing the contribution on a standard installation is welcome to contact me.

 

 

Chris

Link to comment
Share on other sites

Finally got the Y-M-M-P contribute to work on my site.

 

In the readme.txt there is a typo. Under catalog/index.php the last line is missing and end '}' right before the 'else { //default page' statement . It should read:

 

include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING);

echo '</div>';}

//eof Year_Make_ .....

 

 

And for some reason the box module was not displaying the default value (Make, Model....), any values from the table, and the submit button would only make changes to the categories listed, would not go to a new page of items that fit the requirements.

 

To fix this I simply used the old module box and language module box from the previous YMM contribute posting. Could not find the error in the YMMP.

 

This is a great contribute and I'm happy it finally works.

Since my site has been up for a while now I had to install it using the txt file, not the drag on top set.

 

 

Thank you for making this contribute open to the community.

Link to comment
Share on other sites

so i guess I'm not exactly in the clear yet.

I saw a link in this form to http://wardyb.byethost12.com/index.php This is where I first saw a difference.

 

My site only filters items on the index.php page, for new products. It will not work once any of the categories are selected.

example: I can filter by make, the count of items changes (list of categories does not), and once i click on that category every item is displayed instead of just the ones that fit the criteria.

 

I don't even know where to start. I would like the categories list and products list to filter on submit.

Could you at least let me know which files and sections I would have to look through and debug?

 

Thanks.

Link to comment
Share on other sites

.... the placement of the the new php for the index page [ ReadMe.txt #9B ], was the reason that products were only being filtered on the welcome page and not when any of the categories or sub-categories were selected.

 

I'm still working on making it a bit smoother but placing #9B in two locations seemed to solve most of my problems!

Link to comment
Share on other sites

  • 3 weeks later...

So I am having a problem with this still.

 

I have it all installed but when I add a product then I go to do the year make and model enter the info click add... Nothing happens.

Tried on a mac and pc just to make sure it was not the computer I was on.

 

So to me the ADD button is not working. Any thoughts ideas?

 

Thanks

Link to comment
Share on other sites

@_Keith_

 

What browser version are you using ? Are you using a standard installation of osCommerce or a template ? Did you check your code edits for the categories.php file to ensure they are 100% correct ?

 

 

Chris

Link to comment
Share on other sites

@_Keith_

 

Can you post the button code ? I just installed this again on a clean install and it appears to work without an issue and I read the last few pages of this forum and haven't seen any other button issues mentioned.

 

 

 

Chris

Link to comment
Share on other sites

I have a dumb question.

 

When i add a new product there aren't any defined fields for year make and model.

 

How does the contribution sort through my products to generate the YMM's that are available in my store?

 

Would i create a new table for year make and model and drop in the OSC ID for the particular product?

 

Can someone provide me a link to a working example?

 

Thank you very much!

Aaron

Link to comment
Share on other sites

@@GoTTi

 

this mod doesnt have to work on sites for autoparts right? i can use this for other types of sites with similar idea and just change some code around for the labeling im assuming?

 

 

That is correct !

 

 

 

Chris

Link to comment
Share on other sites

  • 1 month later...

Hello,

 

I am having some problems installing this mod. Can anyone help me? I get this error:

 

Fatal error: Cannot redeclare YMM_get_categories_where() (previously declared in /home/pieseaut/public_html/includes/functions/general.php:1383) in /home/pieseaut/public_html/includes/functions/general.php on line 1485

Link to comment
Share on other sites

  • 2 weeks later...

Hello,

 

I am having some problems installing this mod. Can anyone help me? I get this error:

 

Fatal error: Cannot redeclare YMM_get_categories_where() (previously declared in /home/pieseaut/public_html/includes/functions/general.php:1383) in /home/pieseaut/public_html/includes/functions/general.php on line 1485

 

Double check the /home/site-me/public_html/includes/languages/english/modules/boxes folder to make sure bm_year_make_model.php has just defines for titles and no actual php code. This happened to me also and either I mistakenly loaded wrong file in english folders area or the download package has wrong file in wrong place. I did not double check the download package because I chalked it up as my mistake and went on after I fixed it. Although the error I got was about defining class again.

Link to comment
Share on other sites

Another observation of mine, I research a lot of code and have a very large online presence using OSC. This contrib is one of the most powerful I have seen out there, (for my needs). This contrib can be manipulated to do much more than just a parts filter. The 2.3 version using ajax is quite the catch..... I have about 10 hours hack time so far and like very much what I see. I did not know the power of setting cookies and filters until now. I will be harnessing this power further and test my results quite soon. This add-on solves many categorie problems when you get above 900 plus categories. Allows a very precise navigation of your site by stepping in without huge database pulls. Seems fast but testing further is needed. Add a little memcache and this could be real big for me.

Link to comment
Share on other sites

NOW HERE IS THE CODE THAT DONT WORK IF I FOLLOW THE YMM GUIDE

 

<?php

/*

$Id$

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2010 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

// the following cPath references come from application_top.php

$category_depth = 'top';

if (isset($cPath) && tep_not_null($cPath)) {

$categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

$categories_products = tep_db_fetch_array($categories_products_query);

if ($categories_products['total'] > 0) {

$category_depth = 'products'; // display products

} else {

$category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");

$category_parent = tep_db_fetch_array($category_parent_query);

if ($category_parent['total'] > 0) {

$category_depth = 'nested'; // navigate through the categories

} else {

$category_depth = 'products'; // category has no products, but display the 'no products' message

}

}

}

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

$tab_sel = tep_href_link(FILENAME_DEFAULT);

?>

<?php

require(DIR_WS_INCLUDES . 'template_top.php');

?>

 

<?php

if ($category_depth == 'nested') {

$category_query = tep_db_query("select cd.categories_name, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'");

$category = tep_db_fetch_array($category_query);

?>

 

<?php echo tep_draw_content_top();?>

 

<?php echo tep_draw_title_top();?>

<h1><?php echo $category['categories_name']; ?></h1>

<?php echo tep_draw_title_bottom();?>

 

<div class="contentContainer page_un">

 

<?php

 

//bof Year_Make_Model Contribution v2.3.x by Dunweb Designs

if (isset($cPath) && strpos('_', $cPath)) {

// check to see if there are deeper categories within the current category

$category_links = array_reverse($cPath_array);

for($i=0, $n=sizeof($category_links); $i<$n; $i++) {

$categories_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");

$categories = tep_db_fetch_array($categories_query);

if ($categories['total'] < 1) {

// do nothing, go through the loop

} else {

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and " . (YMM_FILTER_CATEGORIES_LISTING == 'Yes' ? YMM_get_categories_where((int)$category_links[$i],$YMM_where) : '') . " c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");

break; // we've found the deepest category the customer is in

}

}

} else {

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and " . (YMM_FILTER_CATEGORIES_LISTING == 'Yes' ? YMM_get_categories_where((int)$current_category_id,$YMM_where) : '') . " c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");

}

//eof Year_Make_Model Contribution v2.3.x by Dunweb Designs

 

$number_of_categories = tep_db_num_rows($categories_query);

 

$rows = 0;

 

$col = 0;

$row = 0;

// $col_items = (MAX_DISPLAY_CATEGORIES_PER_ROW - 1);

 

$prods_content = '

<div class="padding ofh">'. "\n";

$prods_content .= ' <ul class="sub_categories">'. "\n";

while ($categories = tep_db_fetch_array($categories_query)) {

$rows++;

$cPath_new = tep_get_path($categories['categories_id']);

$p_name = '<span><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $categories['categories_name'] . '</a></span>';

$p_pic = '<a class="prods_pic_bg" href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '" style="width:'.(SUBCATEGORY_IMAGE_WIDTH + 2).'px;height:'.(SUBCATEGORY_IMAGE_HEIGHT + 2).'px;">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '';

// $width = (int)(100 / $categories_row) . '%';

 

// if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) {

// $colspan = ((MAX_DISPLAY_CATEGORIES_PER_ROW * 2) - 1) ;

 

 

// if (($col === 0) && ($row != 0)) {

$prods_content .= ''. "\n"; // hor separator start

// }

// if ($col === 0) {

// $prods_content .= ' <ul class="sub_categories">'. "\n";

// }else {

// $prods_content .= ''; // vert separator start

// }

 

$prods_content .=

' <li class="prods_content" style="width:'.(SUBCATEGORY_IMAGE_WIDTH + 2).'px;">'. "\n".

' <div class="pic_padd wrapper_pic_div" style="width:'.(SUBCATEGORY_IMAGE_WIDTH + 2).'px;height:'.(SUBCATEGORY_IMAGE_HEIGHT + 2).'px;">'.$p_pic.''.tep_draw_prod_pic3_top().''.tep_draw_prod_pic3_bottom().'</a></div>'. "\n".

' <div class="name name_padd">'.$p_name.'</div>'. "\n".

' </li>'. "\n";

 

// $col ++;

// if ($col > $col_items) {

// $prods_content .= ''. "\n"; // hor separator start

// $row ++;

// $col = 0;

// }else{

// $prods_content .= ''. "\n"; // vert separator end

// }

 

// }

}

$prods_content .= ' </ul>'. "\n";

 

$prods_content .= '</div>';

// needed for the new products module shown below

$new_products_category_id = $current_category_id;

?>

<div class="contentPadd un">

<?php echo $prods_content; ?>

</div>

 

<?php include(DIR_WS_MODULES . 'new_products.php'); ?>

 

 

</div><?php echo tep_draw_content_bottom();?>

 

<?php

} elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {

// create column list

$define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,

'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,

'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,

'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,

'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,

'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,

'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,

'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);

 

asort($define_list);

 

$column_list = array();

reset($define_list);

while (list($key, $value) = each($define_list)) {

if ($value > 0) $column_list[] = $key;

}

 

$select_column_list = '';

 

for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {

switch ($column_list[$i]) {

case 'PRODUCT_LIST_MODEL':

$select_column_list .= 'p.products_model, ';

break;

case 'PRODUCT_LIST_NAME':

$select_column_list .= 'pd.products_name, ';

break;

case 'PRODUCT_LIST_MANUFACTURER':

$select_column_list .= 'm.manufacturers_name, ';

break;

case 'PRODUCT_LIST_QUANTITY':

$select_column_list .= 'p.products_quantity, ';

break;

case 'PRODUCT_LIST_IMAGE':

$select_column_list .= 'p.products_image, ';

break;

case 'PRODUCT_LIST_WEIGHT':

$select_column_list .= 'p.products_weight, ';

break;

}

}

 

// show the products of a specified manufacturer

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {

// We are asked to show only a specific category

$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 . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' 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)$HTTP_GET_VARS['filter_id'] . "'";

} else {

// 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 . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";

}

} else {

// show the products in a given categorie

if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {

// We are asked to show only specific catgeory

$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 . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' 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 . "'";

} else {

// 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 . "'";

}

}

 

if ( (!isset($HTTP_GET_VARS['sort'])) || (!preg_match('/^[1-8][ad]$/', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {

for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {

if ($column_list[$i] == 'PRODUCT_LIST_NAME') {

$HTTP_GET_VARS['sort'] = $i+1 . 'a';

$listing_sql .= " order by pd.products_name";

break;

}

}

} else {

$sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);

$sort_order = substr($HTTP_GET_VARS['sort'], 1);

 

switch ($column_list[$sort_col-1]) {

case 'PRODUCT_LIST_MODEL':

$listing_sql .= " order by p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_NAME':

$listing_sql .= " order by pd.products_name " . ($sort_order == 'd' ? 'desc' : '');

break;

case 'PRODUCT_LIST_MANUFACTURER':

$listing_sql .= " order by m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_QUANTITY':

$listing_sql .= " order by p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_IMAGE':

$listing_sql .= " order by pd.products_name";

break;

case 'PRODUCT_LIST_WEIGHT':

$listing_sql .= " order by p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_PRICE':

$listing_sql .= " order by final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

}

}

 

$catname = HEADING_TITLE;

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

$image = tep_db_query("select manufacturers_image, manufacturers_name as catname from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");

$image = tep_db_fetch_array($image);

$catname = $image['catname'];

} elseif ($current_category_id) {

$image = tep_db_query("select c.categories_image, cd.categories_name as catname from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");

$image = tep_db_fetch_array($image);

$catname = $image['catname'];

}

?>

 

<?php echo tep_draw_content_top();?>

 

<?php echo tep_draw_title_top();?>

<h1><?php echo $catname; ?></h1>

<?php echo tep_draw_title_bottom();?>

 

<?php

// optional Product List Filter

if (PRODUCT_LIST_FILTER > 0) {

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

$filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name";

} else {

$filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name";

}

$filterlist_query = tep_db_query($filterlist_sql);

if (tep_db_num_rows($filterlist_query) > 1) {

echo tep_draw_form('filter', FILENAME_DEFAULT, 'get') . '<p class="show">' . TEXT_SHOW . ' ';

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']);

$options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES));

} else {

echo tep_draw_hidden_field('cPath', $cPath);

$options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS));

}

echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']);

while ($filterlist = tep_db_fetch_array($filterlist_query)) {

$options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']);

}

echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()" class="select"');

echo tep_hide_session_id() . '</p></form>' . "\n";

// echo '<div class="prods_hseparator">'.tep_draw_separator('spacer.gif', '1', '1').'</div>';

}

}

 

include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING);

?>

 

<?php echo tep_draw_content_bottom();?>

 

<?php

}

//bof Year_Make_Model Contribution v2.3.x by Dunweb Designs

 

elseif($_GET['Make'] || $_GET['Model'] || $_GET['Year']){

 

$define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,

'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,

'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,

'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,

'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,

'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,

'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,

'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);

 

asort($define_list);

 

$column_list = array();

reset($define_list);

while (list($key, $value) = each($define_list)) {

if ($value > 0) $column_list[] = $key;

}

 

$select_column_list = '';

 

for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {

switch ($column_list[$i]) {

case 'PRODUCT_LIST_MODEL':

$select_column_list .= 'p.products_model, ';

break;

case 'PRODUCT_LIST_NAME':

$select_column_list .= 'pd.products_name, ';

break;

case 'PRODUCT_LIST_MANUFACTURER':

$select_column_list .= 'm.manufacturers_name, ';

break;

case 'PRODUCT_LIST_QUANTITY':

$select_column_list .= 'p.products_quantity, ';

break;

case 'PRODUCT_LIST_IMAGE':

$select_column_list .= 'p.products_image, ';

break;

case 'PRODUCT_LIST_WEIGHT':

$select_column_list .= 'p.products_weight, ';

break;

}

}

if($current_category_id){

$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 " . (YMM_FILTER_PRODUCT_LISTING == 'Yes' ? $YMM_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 . "'";

}else{

$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 " . (YMM_FILTER_PRODUCT_LISTING == 'Yes' ? $YMM_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 . "'";

}

 

if ( (!isset($HTTP_GET_VARS['sort'])) || (!preg_match('/^[1-8][ad]$/', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {

for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {

if ($column_list[$i] == 'PRODUCT_LIST_NAME') {

$HTTP_GET_VARS['sort'] = $i+1 . 'a';

$listing_sql .= " order by pd.products_name";

break;

}

}

} else {

$sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);

$sort_order = substr($HTTP_GET_VARS['sort'], 1);

 

switch ($column_list[$sort_col-1]) {

case 'PRODUCT_LIST_MODEL':

$listing_sql .= " order by p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_NAME':

$listing_sql .= " order by pd.products_name " . ($sort_order == 'd' ? 'desc' : '');

break;

case 'PRODUCT_LIST_MANUFACTURER':

$listing_sql .= " order by m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_QUANTITY':

$listing_sql .= " order by p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_IMAGE':

$listing_sql .= " order by pd.products_name";

break;

case 'PRODUCT_LIST_WEIGHT':

$listing_sql .= " order by p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_PRICE':

$listing_sql .= " order by final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

}

}

 

$catname = HEADING_TITLE;

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

$image = tep_db_query("select manufacturers_image, manufacturers_name as catname from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");

$image = tep_db_fetch_array($image);

$catname = $image['catname'];

} elseif ($current_category_id) {

$image = tep_db_query("select c.categories_image, cd.categories_name as catname from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");

$image = tep_db_fetch_array($image);

$catname = $image['catname'];

}

?>

 

<h1><?php echo $catname; ?></h1>

 

<div class="contentContainer">

 

<?php

 

 

include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING);

echo '</div>';

 

//eof Year_Make_Model Contribution v2.3.x by Dunweb Designs

 

else { // default page

$first_page = true;

?>

<?php echo tep_draw_content_top();?>

<div class="none">

 

<?php echo tep_draw_title_top();?>

<h1><?php echo HEADING_TITLE; ?></h1>

<?php echo tep_draw_title_bottom();?>

 

</div >

<div class="contentContainer page_un">

<div class="contentText none">

<?php echo tep_customer_greeting(); ?>

</div>

 

<?php

if (tep_not_null(TEXT_MAIN)) {

?>

 

<div class="contentText">

<?php echo TEXT_MAIN; ?>

</div>

 

<?php

}

?>

<?php

include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS);

include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);

?>

 

</div>

<?php echo tep_draw_content_bottom();?>

<?php

}

 

require(DIR_WS_INCLUDES . 'template_bottom.php');

require(DIR_WS_INCLUDES . 'application_bottom.php');

?>

 

 

 

 

 

I am having the exact same problem. I purchased a template and everything looks fine during installation, except step 9b where I have add codes into [catalog]/index.php

 

My index.php file is different from the standard one, I realise I need to adjust the code somehow to make it work with my template, but can someone point me to the right direction? Where do I even begin?...

 

Any advice will help...

 

Thank You!

Link to comment
Share on other sites

@@willer2k

 

Although some of your template code is altered and out of sequence, the contribution will work. However, you will need to change the placement of the code edits in the index.php to accommodate the template layout.

 

 

 

 

Chris

Link to comment
Share on other sites

Further question, can someone tell me what this code does? :

 

 

9.b]

Find:

 

include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING);

?>

 

</div>

 

<?php

}

 

Add after:

 

 

//bof Year_Make_Model Contribution v2.3.x by Dunweb Designs

 

elseif($_GET['Make'] || $_GET['Model'] || $_GET['Year']){

 

$define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,

'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,

'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,

'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,

'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,

'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,

'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,

'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);

 

asort($define_list);

 

$column_list = array();

reset($define_list);

while (list($key, $value) = each($define_list)) {

if ($value > 0) $column_list[] = $key;

}

 

$select_column_list = '';

 

for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {

switch ($column_list[$i]) {

case 'PRODUCT_LIST_MODEL':

$select_column_list .= 'p.products_model, ';

break;

case 'PRODUCT_LIST_NAME':

$select_column_list .= 'pd.products_name, ';

break;

case 'PRODUCT_LIST_MANUFACTURER':

$select_column_list .= 'm.manufacturers_name, ';

break;

case 'PRODUCT_LIST_QUANTITY':

$select_column_list .= 'p.products_quantity, ';

break;

case 'PRODUCT_LIST_IMAGE':

$select_column_list .= 'p.products_image, ';

break;

case 'PRODUCT_LIST_WEIGHT':

$select_column_list .= 'p.products_weight, ';

break;

}

}

if($current_category_id){

$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 " . (YMM_FILTER_PRODUCT_LISTING == 'Yes' ? $YMM_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 . "'";

}else{

$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 " . (YMM_FILTER_PRODUCT_LISTING == 'Yes' ? $YMM_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 . "'";

}

 

if ( (!isset($HTTP_GET_VARS['sort'])) || (!preg_match('/^[1-8][ad]$/', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {

for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {

if ($column_list[$i] == 'PRODUCT_LIST_NAME') {

$HTTP_GET_VARS['sort'] = $i+1 . 'a';

$listing_sql .= " order by pd.products_name";

break;

}

}

} else {

$sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);

$sort_order = substr($HTTP_GET_VARS['sort'], 1);

 

switch ($column_list[$sort_col-1]) {

case 'PRODUCT_LIST_MODEL':

$listing_sql .= " order by p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_NAME':

$listing_sql .= " order by pd.products_name " . ($sort_order == 'd' ? 'desc' : '');

break;

case 'PRODUCT_LIST_MANUFACTURER':

$listing_sql .= " order by m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_QUANTITY':

$listing_sql .= " order by p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_IMAGE':

$listing_sql .= " order by pd.products_name";

break;

case 'PRODUCT_LIST_WEIGHT':

$listing_sql .= " order by p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_PRICE':

$listing_sql .= " order by final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

}

}

 

$catname = HEADING_TITLE;

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

$image = tep_db_query("select manufacturers_image, manufacturers_name as catname from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");

$image = tep_db_fetch_array($image);

$catname = $image['catname'];

} elseif ($current_category_id) {

$image = tep_db_query("select c.categories_image, cd.categories_name as catname from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");

$image = tep_db_fetch_array($image);

$catname = $image['catname'];

}

?>

 

<h1><?php echo $catname; ?></h1>

 

<div class="contentContainer">

 

<?php

 

 

include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING);

echo '</div>';

 

//eof Year_Make_Model Contribution v2.3.x by Dunweb Designs

 

 

 

 

 

 

 

 

 

 

 

If I know what the code actually does, it will greatly help to fix the issue i'm facing.

Thanks!

Link to comment
Share on other sites

@@willer2k

 

Although some of your template code is altered and out of sequence, the contribution will work. However, you will need to change the placement of the code edits in the index.php to accommodate the template layout.

 

 

 

 

Chris

 

Hey Chris, so if I understand correctly, I don't need to modify the codes, I just need to find the right place to input the code?

 

BTW, thank you so much for such a quick reply, I didn't except help so quickly! :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...