Help, anybody?
Help, anybody?
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.
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.
Last edited by farmex; 6 Dec 2011 at 01:11 AM.
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 I use this stringCode: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'))); } } ?>
it adds product by its manufacturer and model. But when using other manufacturer it's not adding anything to cartCode:index.php?action=buy_now&m=aaa111sss&aribrand=17
Another question I ran in to is, how can I define that manufacturers_id = 17 = EXM?Code:index.php?action=buy_now&m=aaa111sss&aribrand=4
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
Code:<?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'))); } } ?>
It was nice talking to myself, but I figured out last question I had
Code:if ($_GET['aribrand'] == TO) {$_GET['aribrand'] = 4;} if ($_GET['aribrand'] == EXM) {$_GET['aribrand'] = 17;}