Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

manufacturer2 2.0


andes1

Recommended Posts

i got a strange issue , when i add a manufacturer then after if i do edit i got the url of the table manufacturer that show , i double checked all my code i always call manufacturer2

have you guys have the same issue ?

 

try making a new manufacturer 2 with several languages entering only the name

 

then confirm

then edit

and see in the url, you got the url information that correspond to the manufucaturer not manufucaturer 2 , i checked all the call to the table and i made no mistake

MS2

Link to comment
Share on other sites

  • Replies 97
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

hi

 

When i view a manufactuers products, at the top of the page it says 'Whats new here' how can I change this to the name of the chosen manufacturer?

 

heres an example to show you what i mean: http://www.topgoth.co.uk/index.php?manufac...mp;x=2&y=11

thanks,

 

Ben

 

try this works wirth categories, i did not test it with manufacturers

Page Heading Title 1.0

----------------------

Get rid of "Let's See What We Have Here"

 

In the /catalog/index.php, there are three <?php echo HEADING_TITLE; ?>

 

FOR CATEGORIES, just replace the first one

<?php echo HEADING_TITLE; ?>

 

TO

 

<?php echo $category['categories_name'] ?>

 

 

FOR SUBCATEGORIES, just replace the second

<?php echo HEADING_TITLE; ?>

 

TO

 

<?php

$category_query1 = 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 . "'");

$category1 = tep_db_fetch_array($category_query1);

 

if ($category1['categories_name'] != "") {echo $category1['categories_name'];} else { echo HEADING_TITLE;}

?>

 

 

The third <?php echo HEADING_TITLE; ?>

Nothing needed to modify.

Link to comment
Share on other sites

Hello all... I've actually been using the older contribution (don't ask me how I got it working originally back in early 2007 - I cant honestly tell you but I did). And it's working on one site... but not on another - even though both sites are duplicate file sets j with only a different STS Plus template applied to each....

 

On the playertronics site the $manufacturer2 box isn't loading... but on the forcerecordings site it is....

 

Any clue as to why this is?

 

www.playertronics.com

 

www.forcerecordings.com

 

 

I'm totally loosing my mind on this?!!!

Link to comment
Share on other sites

Hello there!

 

Im loosing my mind too!

I installed the contributions from http://www.oscommerce.com/community/contri...,manufacturers2

 

BUt in the home page, appears this:

Fatal error: Call to undefined function tep_cache_manufacturers2_box() in /home/dp000105/public_html/libreria/includes/column_left.php on line 26

 

I see in this post, that the contribution is not update, there is a lot of troubles and mistakes.

Its not a problem with the sql command, cause i create the tables like this:

 

 

CREATE TABLE `manufacturers2` (

`manufacturers2_id` int(11) NOT NULL auto_increment,

`manufacturers2_name` varchar(32) NOT NULL default '',

`manufacturers2_image` varchar(64) default NULL,

`date_added` datetime default NULL,

`last_modified` datetime default NULL,

PRIMARY KEY (`manufacturers2_id`),

KEY `IDX_MANUFACTURERS2_NAME` (`manufacturers2_name`)

) TYPE=MyISAM AUTO_INCREMENT=12 ;

 

 

 

 

CREATE TABLE `manufacturers2_info` (

`manufacturers2_id` int(11) NOT NULL default '0',

`languages_id` int(11) NOT NULL default '0',

`manufacturers2_url` varchar(255) NOT NULL default '',

`url_clicked` int(5) NOT NULL default '0',

`date_last_click` datetime default NULL,

PRIMARY KEY (`manufacturers2_id`,`languages_id`) ---> (here is the mistake... was PRIMARY KEY (`manufacturers_id`,`languages_id`))

) ENGINE=MyISAM DEFAULT CHARSET=latin1;

 

 

SO; PLEASE :thumbsup: could you update the contribution??? I read the post, but i cant find good answers and solutions.

Thanks a lot, and sorry for my english :blush:

Link to comment
Share on other sites

I found the solution for the error: Fatal error: Call to undefined function tep_cache_manufacturers2_box() in /home/dp000105/public_html/libreria/includes/column_left.php on line 26

 

The line 26 on column_left.php is:

echo tep_cache_categories_box();

 

So, i duplicated the following lines of the file toyourshop/includes/funtions/cache.php:

 

function tep_cache_manufacturers_box($auto_expire = false, $refresh = false) {

global $HTTP_GET_VARS, $language;

 

$cache_output = '';

 

$manufacturers_id = '';

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

$manufacturers_id = $HTTP_GET_VARS['manufacturers_id'];

}

 

if (($refresh == true) || !read_cache($cache_output, 'manufacturers_box-' . $language . '.cache' . $manufacturers_id, $auto_expire)) {

ob_start();

include(DIR_WS_BOXES . 'manufacturers.php');

$cache_output = ob_get_contents();

ob_end_clean();

write_cache($cache_output, 'manufacturers_box-' . $language . '.cache' . $manufacturers_id);

}

 

return $cache_output;

}

 

 

And iI replace the word manufacturers for manufacturers2

 

 

 

And in the file includes/column_left.php I add the following lines before the line require(DIR_WS_BOXES . 'whats_new.php');:

 

///manufact 2

if ((USE_CACHE == 'false') && empty($SID)) {

echo tep_cache_manufacturers2_box();

} else {

include(DIR_WS_BOXES . 'manufacturers2.php');

}

/// fin manufact 2

Link to comment
Share on other sites

I have been working on instructions for this contrib, hoping to have the kinks worked out over the next couple of days. I have successfully installed in on a test site, going to go through the install on another later today to be sure I have the instructions worked out properly.

 

 

Hope to have a full contrib upload soon...

Edited by theantiquestore
Link to comment
Share on other sites

Just uploaded a completely new installation of manufacturers2!

 

I've spent quite a few hours (days) on this, my eyes are buggy :blink: but I am pretty sure this works. I've tested and debugged on two sites, however, this does not mean that I didn't miss something. If you find anything I've missed please post it here!

 

It is a long modification process with a bunch of edits, my advice, read it carefully and try to work without distraction.

 

I see no reason why this would not work with multiple languages. You'll just need to edit the language files to show your language.

 

Have fun!

 

http://addons.oscommerce.com/info/2634

Link to comment
Share on other sites

Just uploaded a completely new installation of manufacturers2!

 

I've spent quite a few hours (days) on this, my eyes are buggy :blink:

 

Great work! Thank you for your hard work. :thumbsup:

 

I have installed this contribution and it's working fine, I have followed the steps from the instructions and I didn't encounter any problems. Very well written the instructions!

I do have a question... Is it possible for this second, third, fourth and so on ... manufacturer to appear only in the categories where are the products that belong to that manufacturer?

 

Let's say you have a computer store (my case..:D)... and you are in the category AMD, from CPU parent category. AMD have three types of sockets: 754, 939 and AM2. I want to sort the products by AM2 socket, but I want to appear only a box or a drop-down list with these three types, not all "manufacturers" defined in the admin. And the same thing in the other categories, filter by FSB, DDRI or II...

 

Is that possible? Maybe there is other contribution we can merge with this one?

 

Thank you for your response.

Link to comment
Share on other sites

Hey, I am using Manufacturers2 Version 2.0. I havent upgraded to v3.0 as there dont seem to be any instructions for people already using v2 who want to upgrade.

 

Anyway, I have noticed a slight problem with v2 (that might have been fixed in v3 im not sure). When you add a product and then click edit once you have already added it to your store the value of whatever manufacturer2 you have chosen reverts back to 'none'.

 

For example, if I added a product with manufacturer 'IBM' and added it to the store, if I later wanted to edit that product I would have to choose its manufacturer again as it goes back to 'none' when you click edit.

 

I hope that all made sense, its difficult to explain although a fairly simple problem. It changes that products manufacturer to 'none' when you go to edit that products page. This doesnt happen if you choose to use the original manufacturers box as opposed to the manufacturers2 box.

 

Any ideas?

 

thanks,

 

Ben

Link to comment
Share on other sites

try this works wirth categories, i did not test it with manufacturers

Page Heading Title 1.0

----------------------

Get rid of "Let's See What We Have Here"

 

In the /catalog/index.php, there are three <?php echo HEADING_TITLE; ?>

 

FOR CATEGORIES, just replace the first one

<?php echo HEADING_TITLE; ?>

 

TO

 

<?php echo $category['categories_name'] ?>

FOR SUBCATEGORIES, just replace the second

<?php echo HEADING_TITLE; ?>

 

TO

 

<?php

$category_query1 = 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 . "'");

$category1 = tep_db_fetch_array($category_query1);

 

if ($category1['categories_name'] != "") {echo $category1['categories_name'];} else { echo HEADING_TITLE;}

?>

 

 

The third <?php echo HEADING_TITLE; ?>

Nothing needed to modify.

 

 

Hey,

 

I found this in index.php

 <td class="pageHeading"><?php echo $category['categories_name'] ?> </td>

 

so I Changed it to:

<td class="pageHeading"><?php echo $manufacturer['manufacturers_name'] ?> </td>

 

However, nothing has really changed and I wasnt sure where to edit for manufacturers2, I think what I edited related to the normal manufacturers, although, as you can see here I can filter the products shown although it says nothing on that small grey bar to the left of it.

 

http://www.topgoth.co.uk/44-m-73.html?y=14&x=10

 

any ideas?

Edited by Benjjj6
Link to comment
Share on other sites

Benjj6

 

I'm sorry about no upgrade instructions. The contrib was exhaustive and I just didnt have the time to do it.

 

I am running a site now with 5 manufacturers with the contrib I submitted and I do not have the edit problem.

Link to comment
Share on other sites

  • 2 weeks later...

I need this contribution to separate between the 2 manufacturer lists when I activate the category/manufacturer filter.

 

How can I click manufacturer 1, and get one filter for categories and a second one for manufacturer 2 ?

 

Can I at all? :huh:

Link to comment
Share on other sites

The category filter on the manufacturers page should show with the code from install.txt file in the contrib.

 

To have a manufacturers filter on the product listing page (category page) you'll need to add this to index.php, just before (around line 259) // Get the right image for the top-right:

 

// optional Product List Filter
if (PRODUCT_LIST_FILTER > 0) {
  if (isset($HTTP_GET_VARS['manufacturers2_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.manufacturers2_id = '" . (int)$HTTP_GET_VARS['manufacturer2s_id'] . "' order by cd.categories_name";
  } else {
	$filterlist_sql= "select distinct m.manufacturers2_id as id, m.manufacturers2_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS2 . " m where p.products_status = '1' and p.manufacturers2_id = m.manufacturers2_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers2_name";
  }
  $filterlist_query = tep_db_query($filterlist_sql);
  if (tep_db_num_rows($filterlist_query) > 1) {
	echo '			<td align="center" class="main">' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . TEXT_SHOW . ' ';
	if (isset($HTTP_GET_VARS['manufacturers2_id'])) {
	  echo tep_draw_hidden_field('manufacturers2_id', $HTTP_GET_VARS['manufacturers2_id']);
	  $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES));
	} else {
	  echo tep_draw_hidden_field('cPath', $cPath);
	  $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS2));
	}
	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()"');
	echo '</form></td>' . "\n";
  }
}

 

At this time there is not way to select two different manufacturers and have it sort by both. You will either get manufacturer(1) results OR manufacturer2 results, but no products which match both 1 and 2.

Edited by theantiquestore
Link to comment
Share on other sites

  • 4 weeks later...

I have downloaded version 3 and when i run the sql statement in phpmyadmin, i get this error:

 

Error

 

SQL-query :

 

CREATE TABLE `manufacturers2` (

`manufacturers2_id` int( 11 ) NOT NULL auto_increment,

`manufacturers2_name` varchar( 32 ) NOT NULL default '',

`manufacturers2_image` varchar( 64 ) default NULL ,

`date_added` datetime default NULL ,

`last_modified` datetime default NULL ,

PRIMARY KEY ( `manufacturers2_id` ) ,

KEY `IDX_MANUFACTURERS2_NAME` ( `manufacturers2_name` )

)ENGINE = MyISAM DEFAULTCHARSET = latin1AUTO_INCREMENT = 21

 

MySQL said:

 

You have an error in your SQL syntax near 'ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ' at line 9

 

 

What is wrong? the code i used was:

 

 

CREATE TABLE `manufacturers2` (

`manufacturers2_id` int(11) NOT NULL auto_increment,

`manufacturers2_name` varchar(32) NOT NULL default '',

`manufacturers2_image` varchar(64) default NULL,

`date_added` datetime default NULL,

`last_modified` datetime default NULL,

PRIMARY KEY (`manufacturers2_id`),

KEY `IDX_MANUFACTURERS2_NAME` (`manufacturers2_name`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ;

 

CREATE TABLE `manufacturers2_info` (

`manufacturers2_id` int(11) NOT NULL default '0',

`languages_id` int(11) NOT NULL default '0',

`manufacturers2_url` varchar(255) NOT NULL default '',

`url_clicked` int(5) NOT NULL default '0',

`date_last_click` datetime default NULL,

PRIMARY KEY (`manufacturers2_id`,`languages_id`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1;

 

ALTER TABLE `products` ADD `manufacturers2_id` int(11) default NULL

Link to comment
Share on other sites

ok i worked out the table, but it doesn't work how i want it too......

 

hello i wonder if you can help me?

 

i am setting up a lingerie site....

 

using categories for example bras > then sub cats for example balcony bra

and half cup bra

 

then using manufacturers for designers....the problem is i need collections

or styles within the manufacturers, to load the same way sub categories do

in categories.

 

 

could anyone help me please?

 

thanks in advance

Link to comment
Share on other sites

  • 3 weeks later...

First of all, thanks alot to anyone who made this great contrib possbile.

 

@theantiquestore,

unfortunately your way doesn't work to filter the product_listing for a manufacturer2. osCommerce doesn't find a product. The URL says:

...mysite/catalog/index.php?cPath=1_4&sort=2a&filter_id=21

 

the filter_id is correct, no.21 is an existing manufacturer2_id, but osC says still "no products found". Also the session_id is stripped.

Btw, if I use the manufacturer2_box that is included in the contrib, it works without any problem. All products of manufacturer2_id=21 are correctly shown.

Do you maybe have an idea why? I tested your way in two shops, both showed the same error.

 

Thanks in advance!

Peter

Link to comment
Share on other sites

  • 2 weeks later...

hi, just installed but its not working,

 

on my admin i see this:

 

BOX_HEADING_CONFIGURATION

BOX_HEADING_CATALOG

BOX_CATALOG_CATEGORIES_PRODUCTS

BOX_CATALOG_CATEGORIES_PRODUCTS_ATTRIBUTES

BOX_CATALOG_MANUFACTURERS

Size

BOX_CATALOG_REVIEWS

BOX_CATALOG_SPECIALS

BOX_CATALOG_PRODUCTS_EXPECTED

BOX_CATALOG_DISCOUNT_COUPONS

BOX_HEADING_MODULES

BOX_HEADING_CUSTOMERS

BOX_HEADING_LOCATION_AND_TAXES

BOX_HEADING_LOCALIZATION

BOX_HEADING_REPORTS

BOX_HEADING_TOOLS

 

 

 

and i click on the SIZE which is what i named the second drop down menu and the link is going to: http://site.net/shop/admin/FILENAME_MANUFACTURERS2

 

how do i fix this problem?

Link to comment
Share on other sites

First of all, thanks alot to anyone who made this great contrib possbile.

 

@theantiquestore,

unfortunately your way doesn't work to filter the product_listing for a manufacturer2. osCommerce doesn't find a product. The URL says:

...mysite/catalog/index.php?cPath=1_4&sort=2a&filter_id=21

 

 

the filter_id is correct, no.21 is an existing manufacturer2_id, but osC says still "no products found". Also the session_id is stripped.

Btw, if I use the manufacturer2_box that is included in the contrib, it works without any problem. All products of manufacturer2_id=21 are correctly shown.

Do you maybe have an idea why? I tested your way in two shops, both showed the same error.

 

Thanks in advance!

Peter

 

Hi,

 

I have a working code, based on "theantiquestore" instructions, with manufacturers2 filter on the product listing page and osc manufacturers page. The last contribution doesn't work for me.

 

I´m not using osc manufacturers2 box.

 

This to filter manufacturers2 as a product type:

 

EX:

Choose cartegory "Digital Cameras" manufacturers2 filters "4 MPixel, 6 MPixel"

Choose manufacturer "Panasonic" manufacturers2 filters "4 MPixel, 6 MPixel, Ribbon Fax, 2.6 Ghz Phone"

Only options that exists in the curent products/manufacturers.

 

Now I´m working in complete integration, with 2 lists updated at selection of one of then.

 

Any ideas will be welcome.

 

index.php, the 2 filters here.

 

<?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_INFO' => PRODUCT_LIST_INFO,
                        '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_INFO':
 		  $select_column_list .= 'pd.products_info, ';
         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'] . "'";
     } elseif (isset($HTTP_GET_VARS['filter_id2']) && tep_not_null($HTTP_GET_VARS['filter_id2'])) {

  $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 p.manufacturers2_id = '" . (int)$HTTP_GET_VARS['filter_id2'] . "'";

  } 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 . "'";
     } elseif (isset($HTTP_GET_VARS['filter_id2']) && tep_not_null($HTTP_GET_VARS['filter_id2'])) {
// We are asked to show only specific catgeory
       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers2_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_MANUFACTURERS2 . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers2_id = m.manufacturers2_id and m.manufacturers2_id = '" . (int)$HTTP_GET_VARS['filter_id2'] . "' 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'])) || (!ereg('^[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_INFO':
         $listing_sql .= " order by pd.products_info " . ($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;
     }
   }
?>
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
<?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";

    $filterlist_sql2= "select distinct m2.manufacturers2_id as id, m2.manufacturers2_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_MANUFACTURERS2 . " m2, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers2_id = m2.manufacturers2_id and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by m2.manufacturers2_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_sql2= "select distinct m2.manufacturers2_id as id, m2.manufacturers2_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS2 . " m2 where p.products_status = '1' and p.manufacturers2_id = m2.manufacturers2_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m2.manufacturers2_name";

  }
     $filterlist_query = tep_db_query($filterlist_sql);
     if (tep_db_num_rows($filterlist_query) > 1) {
       echo '            <td align="center" class="main">' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . 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()"');
       echo tep_hide_session_id() . '</form></td>' . "\n";
     }
  $filterlist_query2 = tep_db_query($filterlist_sql2);
    if (tep_db_num_rows($filterlist_query2) >= 1) {
       echo '            <td align="center" class="main">' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . TEXT_SHOW . ' ';
       if (isset($HTTP_GET_VARS['manufacturers_id'])) {
       echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']);
       } else {echo tep_draw_hidden_field('cPath', $cPath);}
	$options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS2));
       echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']);
       while ($filterlist2 = tep_db_fetch_array($filterlist_query2)) {
       $options[] = array('id' => $filterlist2['id'], 'text' => $filterlist2['name']);
       }
       echo tep_draw_pull_down_menu('filter_id2', $options, (isset($HTTP_GET_VARS['filter_id2']) ? $HTTP_GET_VARS['filter_id2'] : ''), 'onchange="this.form.submit()"');
       echo '</form></td>' . "\n";
     }
}

Link to comment
Share on other sites

does anyone have a working version of this contribution?

 

I have these problems :

1. the dropdown box in index.php only shows one manufacturer2 (the second from the DB, there are 5 inserted!)

2. if I select that only manufacturer2 from that box.. it shows all the products that have manufacturer2 feature

Link to comment
Share on other sites

does anyone have a working version of this contribution?

 

I have these problems :

1. the dropdown box in index.php only shows one manufacturer2 (the second from the DB, there are 5 inserted!)

2. if I select that only manufacturer2 from that box.. it shows all the products that have manufacturer2 feature

 

my bad

it only shows the manufacturers2 that you actually use.... and I used only one: the second (that appeared in the dropdown)

 

so the contribution works great!!!!!

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

Hi!

I wonder what i have done wrong, i have installed everything as i should but when i have selected example: wallet in my dropdownmenu for categories everything works so i can choose in the new dropdown in productlist for change to either all manufacturers or choose a single manufacturer but the new dropdown for manufacturers2 is not showing up on the page.

 

in admin it works so i can put the info on to the product about manufacturers2 so the only problem is that it dont show up when i have selected a category or manufactur on the default page.

 

Anyone know how i can make this work??

 

Regards Tony

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...