Zen Cart Logo
Forums / General Questions / Same model number, different manufacturers/products

Same model number, different manufacturers/products

Views: 3,447

Results 1 to 8 of 8
2 Dec 2011, 5:23 PM
#1
farmex avatar

farmex

New Zenner

Join Date:
Nov 2011
Posts:
21
Plugin Contributions:
0

Same model number, different manufacturers/products

Continuing this thread here http://www.zen-cart.com/forum/showthread.php?t=188949

Another problem I ran into. PartStream is working right now and it adds products to the cart.
It generates link like this

index.php?action=buy_now&m=59297&arireturnurl={arireturnurl}&ariqty={aripartqty}&ariprice=76.13&aribrand=TO

So request to ZC looks like this

action buy_now
m 59297
ariqty 1
ariprice 76.13
aribrand TO

m=59297 - model number
aribrand=TO - manufacturer

The problem is that one company(TORO) bought two others (exmark and lawn-boy) and most of the parts are having same model number, the difference is in price.
So I have to have all parts from three "different" manufacturers in catalog, and most of them have same model numbers. I will have around 300k parts in catalog and even different parts(not just manufacturers) would have same model number.

Here are the questions. Is there a way to make zen cart pick the product by its manufacturer AND model, not just model? What have to be done to prevent linking products if they have same model but different manufacturers. How to make abbreviations of manufacturers for aribrand, so Toro=TO, Briggs & Stratton=BRG, etc ?

Any help would be great.

p.s.

I know DrByte got something to say :blush:

3 Dec 2011, 4:37 PM
#2
farmex avatar

farmex

New Zenner

Join Date:
Nov 2011
Posts:
21
Plugin Contributions:
0

Re: Same model number, different manufacturers/products

bump bump

5 Dec 2011, 4:36 PM
#3
farmex avatar

farmex

New Zenner

Join Date:
Nov 2011
Posts:
21
Plugin Contributions:
0

Re: Same model number, different manufacturers/products

Help, anybody?

5 Dec 2011, 11:27 PM
#4
force avatar

force

New Zenner

Join Date:
Oct 2011
Posts:
21
Plugin Contributions:
0

Re: Same model number, different manufacturers/products

I'm not sure if this helps but, the way I sent my cart up is by using prefixes for each manufactures so I can identify the manufacture part quickly.

For example, the manufacture part number might be 222-010 and the manufacture is Vooloo. I will make the Vooloo prefix a "VOO".

So the part number I enter into the zen cart database is VOO-222-010

So with every part number normally the first 3 letters will tell me what manufacture it is just by looking at it. It makes things very simple.

Another example. manufacture part number is 555-555. Manufacture name LETSGOO. I will them make the part number LET-555-555.

I hope this helps.

6 Dec 2011, 12:07 AM
#5
farmex avatar

farmex

New Zenner

Join Date:
Nov 2011
Posts:
21
Plugin Contributions:
0

Re: Same model number, different manufacturers/products

force,

Not really. ARI PartStream is separate application that I've integrated in ZC with DrByte's help. This is a tool for parts look-up and once customer found whatever he needs, he adds it to cart, partstream sends this request to ZC

index.php?action=buy_now&m=59297&arireturnurl={arireturnurl}&ariqty={aripartqty}&ariprice=76.13&aribrand=TO

Now, eXmark got same model number which is 59297 but the price is different and aribrand=EXM

I can't change anything on their(partstream) side, so I have to work on Zen Cart and bend it around PartStream. I can't put TO-59297 or EXM-59297 for model number, because PartStream is requesting model and manufacturer.

I know what I have to do, just need some help on technical part.

-Need to define manufacturers abbreviations (Toro=TO, Exmark=EXM, etc). Probably need to add "aribrand" column to manufacturers table
-"Turn off" linking and duplicating of products if they have same model but different manufacturers
-Define "aribrand" in cart actions

Because of my poor knowledge of PHP(I'm studying though), I need some help.

9 Dec 2011, 6:07 PM
#6
farmex avatar

farmex

New Zenner

Join Date:
Nov 2011
Posts:
21
Plugin Contributions:
0

Re: Same model number, different manufacturers/products

Here's what I got so far. I added two products with same model number, different price and name for testing.

Here's extra cart action

if (isset($_GET['action']) && $_GET['action']=='buy_now' && isset($_GET['m']) && isset($_GET['aribrand']) && !isset($_GET['products_id']))
{
  $sql= "select products_id from " . TABLE_PRODUCTS . " where products_model = :themodel:";
  $sql= "select products_id from " . TABLE_PRODUCTS . " where manufacturers_id = :brand:";
  $sql = $db->bindvars($sql, ':themodel:', $_GET['m'], 'string');
  $sql = $db->bindvars($sql, ':brand:', $_GET['aribrand'], 'string');
  $lookup = $db->Execute($sql);
  if ($lookup->RecordCount() == 1)
  {
    $_GET['products_id'] = $lookup->fields['products_id'];
	unset($_GET['aribrand']);
	unset($_GET['m']);
	zen_redirect(zen_href_link($goto, zen_get_all_get_params('m')));
  }
}
?>

if I use this string

index.php?action=buy_now&m=aaa111sss&aribrand=17

it adds product by its manufacturer and model. But when using other manufacturer it's not adding anything to cart

index.php?action=buy_now&m=aaa111sss&aribrand=4

Another question I ran in to is, how can I define that manufacturers_id = 17 = EXM?

9 Dec 2011, 6:51 PM
#7
farmex avatar

farmex

New Zenner

Join Date:
Nov 2011
Posts:
21
Plugin Contributions:
0

Re: Same model number, different manufacturers/products

Got it working and picking product by its manufacturer and model.

So the last question I have is how can I define that if manufacturers_id=17 it also is "EXM"

Here's working extra cart action, if anybody would need it

<?php
/**
 * Custom shopping Cart actions
 *
 * @package initSystem
 * @copyright Copyright 2003-2011 Zen Cart Development Team
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 */
if (!defined('IS_ADMIN_FLAG')) {
  die('Illegal Access');
}

/**
 * check whether an "action" has been set. And if m= & aribrand= is set but no products_id is set,
 * then lookup products_id from products_model (m) and manufacturers_id (aribrand)
 */
if (isset($_GET['action']) && $_GET['action']=='buy_now' && isset($_GET['m']) && isset($_GET['aribrand']) && !isset($_GET['products_id']))
{
  $sql= "select products_id from " . TABLE_PRODUCTS . " where products_model = :themodel: && manufacturers_id = :brand: LIMIT 1";
  $sql = $db->bindvars($sql, ':themodel:', $_GET['m'], 'string');
  $sql = $db->bindvars($sql, ':brand:', $_GET['aribrand'], 'string');
  $lookup = $db->Execute($sql);
  if ($lookup->RecordCount() == 1)
  {
    $_GET['products_id'] = $lookup->fields['products_id'];
	unset($_GET['aribrand']);
	unset($_GET['m']);
	zen_redirect(zen_href_link($goto, zen_get_all_get_params('m')));
	zen_redirect(zen_href_link($goto, zen_get_all_get_params('aribrand')));
  }
}
?>
9 Dec 2011, 8:02 PM
#8
farmex avatar

farmex

New Zenner

Join Date:
Nov 2011
Posts:
21
Plugin Contributions:
0

Re: Same model number, different manufacturers/products

It was nice talking to myself, but I figured out last question I had :D

if ($_GET['aribrand'] == TO) {$_GET['aribrand'] = 4;}
if ($_GET['aribrand'] == EXM) {$_GET['aribrand'] = 17;}