Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Multi_Vendor_Shipping new thread


blucollarguy

Recommended Posts

Before I install this contribution, I was wondering if anyone can tell me if the prices are set by the admin or can they be obtained from either fedex, ups or whoever the shipper is. I'm looking for a fedex contribution with dimension and weight support that'll grab the quotes from fedex and display it for my customer.

Link to comment
Share on other sites

Before I install this contribution, I was wondering if anyone can tell me if the prices are set by the admin or can they be obtained from either fedex, ups or whoever the shipper is. I'm looking for a fedex contribution with dimension and weight support that'll grab the quotes from fedex and display it for my customer.

 

No such animal exists for 2.2.., 3.0 will hav WSDL http://addons.oscommerce.com/info/6788

 

FedEx Direct for 2.2 (fedex1.php) will pull quotes based on weight but not on dimensions... http://addons.oscommerce.com/info/1462 and is included in MVS (2.06 ver I believe)

-Dave

Link to comment
Share on other sites

admin/orders.php gets the data for the order from the order class. This is displayed in admin/vendor_order_info.php. So try this: at the top of that file, add the following code:

 

print '<pre>';
print_r ($order->products);
print '</pre>';

Then go take a look at the Orders page. You should see the data on the page above the display you posted above. Copy that data and post it here. We'll see if that tells us anything.

 

with

print '<pre>';
print_r ($order->products);
print '</pre>';

at the top of admin/vendor_order_info.php

 

Result

 

Array
(
   [0] => Array
       (
           [Vid] => 3
           [Vname] => Vendor 2
           [Vmodule] => flat
           [Vmethod] => Best Way
           [Vcost] => 6.0000
           [Vship_tax] => 0.0000
           [Vorder_sent] => yes
           [Vnoname] => Shipper
           [spacer] => -
       )

   [1] => Array
       (
           [Vid] => 1
           [Vname] => My Store
           [Vmodule] => item
           [Vmethod] => Best Way
           [Vcost] => 3.5000
           [Vship_tax] => 0.0000
           [Vorder_sent] => yes
           [Vnoname] => Shipper
           [spacer] => -
       )

)

-Dave

Link to comment
Share on other sites

That array is missing the entire orders_products sub-array. That's why you aren't seeing any data. So now we need to look at admin/includes/classes/orders.php. Check to see that following code exists, starting at Line 116:

 

          $index = 0;
         $orders_products_query = tep_db_query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price, vendors_id from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int) $order_id . "' and vendors_id = '" . (int) $vendor_order['vendors_id'] . "'");

         while ($orders_products = tep_db_fetch_array($orders_products_query)) {
           $this->products[$index2]['orders_products'][$index] = array (
             'qty' => $orders_products['products_quantity'],
             'name' => $orders_products['products_name'],
             'tax' => $orders_products['products_tax'],
             'model' => $orders_products['products_model'],
             'price' => $orders_products['products_price'],
             'vendor_name' => $orders_products['vendors_name'],
             'vendor_ship' => $orders_products['shipping_module'],
             'shipping_method' => $orders_products['shipping_method'],
             'shipping_cost' => $orders_products['shipping_cost'],
             'final_price' => $orders_products['final_price'],
             'spacer' => '-'
           );

           $subindex = 0;
           $attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int) $order_id . "' and orders_products_id = '" . (int) $orders_products['orders_products_id'] . "'");
           if (tep_db_num_rows($attributes_query)) {
             while ($attributes = tep_db_fetch_array($attributes_query)) {
               $this->products[$index2]['orders_products'][$index]['attributes'][$subindex] = array (
                 'option' => $attributes['products_options'],
                 'value' => $attributes['products_options_values'],
                 'prefix' => $attributes['price_prefix'],
                 'price' => $attributes['options_values_price']
               );

               $subindex++;
             }
           }
           $index++;
         }

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

No such animal exists for 2.2.., 3.0 will hav WSDL http://addons.oscommerce.com/info/6788

 

FedEx Direct for 2.2 (fedex1.php) will pull quotes based on weight but not on dimensions... http://addons.oscommerce.com/info/1462 and is included in MVS (2.06 ver I believe)

 

That sucks...so exactly what are people doing right now that need both dimensions and weight short from hiring a php coder to implement it.

Link to comment
Share on other sites

The code is there verbatim. Here is the entire file. I made a note towrds the bottom regarding one query that did not match the contribution file. There was no change of output with either query tested

 

<?php
/*
 $Id: order.php 1739 2007-12-20 00:52:16Z hpdl $
 adapted for Separate Pricing Per Customer 2006/04/13
 $Loc: /catalog/admin/includes/classes/ $
 $Mod: MVS V1.2 2009/02/28 JCK/CWG $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 class order {
   var $info, $totals, $products, $customer, $delivery;

   function order($order_id) {
     $this->info = array();
     $this->totals = array();
     $this->products = array();
     $this->customer = array();
     $this->delivery = array();

     $this->query($order_id);
   }

   function query($order_id) {
     // BOF add SPPC customers_group_name to the info
     $order_query = tep_db_query("select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, o.customers_telephone, o.customers_email_address, customers_address_format_id, customers_group_name, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " o left join " . TABLE_CUSTOMERS . " using(customers_id) left join " . TABLE_CUSTOMERS_GROUPS . " using(customers_group_id) where orders_id = '" . (int)$order_id . "'");
     // EOF add SPPC customer_group_name to the info
     $order = tep_db_fetch_array($order_query);

     $totals_query = tep_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' order by sort_order");
     while ($totals = tep_db_fetch_array($totals_query)) {
       $this->totals[] = array('title' => $totals['title'],
                               'text' => $totals['text']);
     }

     $this->info = array('currency' => $order['currency'],
                         'currency_value' => $order['currency_value'],
                         'payment_method' => $order['payment_method'],
                         'cc_type' => $order['cc_type'],
                         'cc_owner' => $order['cc_owner'],
                         'cc_number' => $order['cc_number'],
                         'cc_expires' => $order['cc_expires'],
                         'date_purchased' => $order['date_purchased'],
                         'orders_status' => $order['orders_status'],
                         'last_modified' => $order['last_modified']);

     $this->customer = array('name' => $order['customers_name'],
                             'company' => $order['customers_company'],
                             'street_address' => $order['customers_street_address'],
                             'suburb' => $order['customers_suburb'],
                             'city' => $order['customers_city'],
                             'postcode' => $order['customers_postcode'],
                             'state' => $order['customers_state'],
                             'country' => $order['customers_country'],
                             'format_id' => $order['customers_address_format_id'],
                             // BOF SPPC
                             'customers_group_name' => $order['customers_group_name'],
                             // EOF SPPC
                             'telephone' => $order['customers_telephone'],
                             'email_address' => $order['customers_email_address']);

     $this->delivery = array('name' => $order['delivery_name'],
                             'company' => $order['delivery_company'],
                             'street_address' => $order['delivery_street_address'],
                             'suburb' => $order['delivery_suburb'],
                             'city' => $order['delivery_city'],
                             'postcode' => $order['delivery_postcode'],
                             'state' => $order['delivery_state'],
                             'country' => $order['delivery_country'],
                             'format_id' => $order['delivery_address_format_id']);

     $this->billing = array('name' => $order['billing_name'],
                            'company' => $order['billing_company'],
                            'street_address' => $order['billing_street_address'],
                            'suburb' => $order['billing_suburb'],
                            'city' => $order['billing_city'],
                            'postcode' => $order['billing_postcode'],
                            'state' => $order['billing_state'],
                            'country' => $order['billing_country'],
                            'format_id' => $order['billing_address_format_id']);
//MVS Start
     $orders_shipping_id = '';
     $check_new_vendor_data_query = tep_db_query("select orders_shipping_id, orders_id, vendors_id, vendors_name, shipping_module, shipping_method, shipping_cost, vendor_order_sent from " . TABLE_ORDERS_SHIPPING . " where orders_id = '" . (int) $order_id . "'");
     while ($checked_data = tep_db_fetch_array($check_new_vendor_data_query)) {
       $this->orders_shipping_id = $checked_data['orders_shipping_id'];
     }

     if (tep_not_null($this->orders_shipping_id)) {
       $index2 = 0;
       //let's get the Vendors
       $vendor_data_query = tep_db_query("select orders_shipping_id, orders_id, vendors_id, vendors_name, shipping_module, shipping_method, shipping_cost, shipping_tax, vendor_order_sent from " . TABLE_ORDERS_SHIPPING . " where orders_id = '" . (int) $order_id . "'");
       while ($vendor_order = tep_db_fetch_array($vendor_data_query)) {

         $this->products[$index2] = array (
           'Vid' => $vendor_order['vendors_id'],
           'Vname' => $vendor_order['vendors_name'],
           'Vmodule' => $vendor_order['shipping_module'],
           'Vmethod' => $vendor_order['shipping_method'],
           'Vcost' => $vendor_order['shipping_cost'],
           'Vship_tax' => $vendor_order['shipping_tax'],
           'Vorder_sent' => $vendor_order['vendor_order_sent'], //a yes=sent a no=not sent
           'Vnoname' => 'Shipper',
           'spacer' => '-'
         );

         $index = 0;
         $orders_products_query = tep_db_query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price, vendors_id from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int) $order_id . "' and vendors_id = '" . (int) $vendor_order['vendors_id'] . "'");

         while ($orders_products = tep_db_fetch_array($orders_products_query)) {
           $this->products[$index2]['orders_products'][$index] = array (
             'qty' => $orders_products['products_quantity'],
             'name' => $orders_products['products_name'],
             'tax' => $orders_products['products_tax'],
             'model' => $orders_products['products_model'],
             'price' => $orders_products['products_price'],
             'vendor_name' => $orders_products['vendors_name'],
             'vendor_ship' => $orders_products['shipping_module'],
             'shipping_method' => $orders_products['shipping_method'],
             'shipping_cost' => $orders_products['shipping_cost'],
             'final_price' => $orders_products['final_price'],
             'spacer' => '-'
           );

           $subindex = 0;
           $attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int) $order_id . "' and orders_products_id = '" . (int) $orders_products['orders_products_id'] . "'");
           if (tep_db_num_rows($attributes_query)) {
             while ($attributes = tep_db_fetch_array($attributes_query)) {
               $this->products[$index2]['orders_products'][$index]['attributes'][$subindex] = array (
                 'option' => $attributes['products_options'],
                 'value' => $attributes['products_options_values'],
                 'prefix' => $attributes['price_prefix'],
                 'price' => $attributes['options_values_price']
               );

               $subindex++;
             }
           }
           $index++;
         }
         $index2++;
       }

     } else { // old order, use the regular osC data
//MVS End

     $index = 0;

//// Why is this here? my edit error? reverted to original query below . Which is correct?
//          $orders_products_query = tep_db_query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price, vendors_id from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int) $order_id . "' and vendors_id = '" . (int) $vendor_order['vendors_id'] . "'");

         $orders_products_query = tep_db_query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int) $order_id . "'");

     while ($orders_products = tep_db_fetch_array($orders_products_query)) {
       $this->products[$index] = array('qty' => $orders_products['products_quantity'],
                                       'name' => $orders_products['products_name'],
                                       'model' => $orders_products['products_model'],
                                       'tax' => $orders_products['products_tax'],
                                       'price' => $orders_products['products_price'],
                                       'final_price' => $orders_products['final_price']);

       $subindex = 0;
       $attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");
       if (tep_db_num_rows($attributes_query)) {
         while ($attributes = tep_db_fetch_array($attributes_query)) {
           $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],
                                                                    'value' => $attributes['products_options_values'],
                                                                    'prefix' => $attributes['price_prefix'],
                                                                    'price' => $attributes['options_values_price']);

           $subindex++;
         }
       }
       $index++;
     }
//MVS
   }
 }
 }

?>

-Dave

Link to comment
Share on other sites

It's a bit difficult to second-guess code that I can't test myself, so bear with me here. This is going to involve a bit of guesswork. For the first attempt, I'm guessing that the changes in the query (Line 31 in your file) are interfering with retrieving the information from the database. Try replacing that with the query from the MVS file and see if that changes anything.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

The missing data should be retrieved by the query on line 112 of your file. That query is dependent on the $order_id and $vendor_order['vendors_id']. We've established that both of those are being set. The only remaining possibility is that the data is really not in the database. Could you please confirm that the data exists in the orders_products table for this order ID and a vendors_id of 1 and 3.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Debugging something like this is a process. It's a matter of following the data. We're not finished by any means; you need to look at the code that should be putting the data into the database. That's in catalog/checkout_process.php, lines 233 - 494 in the MVS distribution. Verify that all of that code is present and unmodified. Also, if you are using any payment module that provides its own return page (Paypal, etc.) this code must be in that return page.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

catalog/checkout_process.php

 

Our files are identical with 3 differences

 

line 122 line added for Order Editor

mine

'shipping_module' => $shipping['id'], // Order Editor 5.0.6.6

 

line 255 (changed for php5 and LEFT JOIN)

yours

from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa

mine

from (" . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa)

 

Section added line 270 for SPPC

mine

// BOF Separate Pricing Per Customer attribute_groups mod
 if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
   $attributes_group_query = tep_db_query("select pag.options_values_price, pag.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa left join " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " pag using(products_attributes_id) where pa.products_id = '" . tep_get_prid($order->products[$i]['id']) . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pag.customers_group_id = '" . (int)$_SESSION['sppc_customer_group_id'] . "'");
	 if ($attributes_group = tep_db_fetch_array($attributes_group_query)) {
		 $attributes_values['options_values_price'] = $attributes_group['options_values_price'];
		 $attributes_values['price_prefix'] = $attributes_group['price_prefix'];
	 }
 }
// EOF Separate Pricing Per Customer attribute_groups mod

 

the file is otherwise identical to the contribution.

 

thank you Jim for your patience - I am learning quite a bit

-Dave

Link to comment
Share on other sites

Also, if you are using any payment module that provides its own return page (Paypal, etc.) this code must be in that return page.

 

For the test transactions so far Ive just been using check/moneyorder at checkout. I'll get to paypal next. From my other sites, I dont recall paypal WPP by dynamo effects to have its own return page. I think it works within the osc framework and EC lands at checkout success... I will look. Please correct me if I am wrong.

-Dave

Link to comment
Share on other sites

The Paypal modules that I have looked at use their own processing page and skip checkout_process.php. Look carefully at any module you use, or ask about this on the support thread for the module. Some of these already have MVS support as an option. I'm not up to date on those modules, so I won't suggest one here.

 

On to the debugging. In checkout_process.php, find this code (lines 233-243 in the distribution)

//MVS - added 'vendors_id' => ...
   $sql_data_array = array ('orders_id' => $insert_id, 
                            'products_id' => tep_get_prid($order->products[$i]['id']), 
                            'products_model' => $order->products[$i]['model'], 
                            'products_name' => $order->products[$i]['name'], 
                            'products_price' => $order->products[$i]['price'], 
                            'final_price' => $order->products[$i]['final_price'], 
                            'products_tax' => $order->products[$i]['tax'], 
                            'products_quantity' => $order->products[$i]['qty'],
                            'vendors_id' => $order->products[$i]['vendors_id']
                           );

Just after that code, add this:

 

print '<pre>';
print_r ($sql_data_array);
print '</pre>';

Now try a test order. You will get an array displayed when you get to checkout_process.php. Note that this will also cause a nasty error message instead of the success page. That's normal; we're only interested in seeing the array data.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Good morning Jim,

I was not able to see the array with

print '<pre>';
print_r ($sql_data_array);
print '</pre>';

The order would complete to checkout_success without errors

 

So I used

print '<pre>';
print_r ($sql_data_array);
print '</pre>';
exit;

 

the output is:

 

Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /var/www/dsa/includes/functions/database.php on line 133

Array
(
   [orders_id] => 18
   [products_id] => 8
   [products_model] => DVD-ABUG
   [products_name] => A Bug's Life
   [products_price] => 35.9900
   [final_price] => 35.99
   [products_tax] => 0
   [products_quantity] => 1
   [vendors_id] => 
)

 

The warning is from the "exit;" being used? or ?

Vendors_id is blank obviously

-Dave

Link to comment
Share on other sites

That's a surprise; it should have thrown an error and halted at the redirect. Oh well, you got the data anyway. As I suspected, the vendors_id is not being set. That's the crucial bit of information that is needed to retrieve all the rest. That comes from catalog/includes/classes/order.php. Please verify that this code exists (lines 225-237 in the distribution)

        $this->products[$index] = array('qty' => $products[$i]['quantity'],
                                       'name' => $products[$i]['name'],
                                       'model' => $products[$i]['model'],
                                       'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
                                       'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
                                       'price' => $products[$i]['price'],
                                       'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']),
                                       //MVS start
                                       'vendors_id' => $products[$i]['vendors_id'],
                                       'vendors_name' => $products[$i]['vendors_name'],
                                       //MVS end
                                       'weight' => $products[$i]['weight'],
                                       'id' => $products[$i]['id']);

If that's correct, we will need to look at the cart class next.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

catalog/includes/classes/order.php

 

Our files are identical with the following exceptions

 

Query at line 144 (modifed for mysql5 LEFT JOIN)

Yours

      $customer_address_query = tep_db_query("select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int)$customer_id . "' and ab.customers_id = '" . (int)$customer_id . "' and c.customers_default_address_id = ab.address_book_id");

Mine

      $customer_address_query = tep_db_query("select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from (" . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab) left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int)$customer_id . "' and ab.customers_id = '" . (int)$customer_id . "' and c.customers_default_address_id = ab.address_book_id");

 

and towards the bottom, 4 sections added for SPPC

 

your line 296, inserted

      $index = 0;
     $products = $cart->get_products();
// BOF Separate Pricing Per Customer
    if(!isset($_SESSION['sppc_customer_group_show_tax'])) {
       $customer_group_show_tax = '1';
    } else {
       $customer_group_show_tax = $_SESSION['sppc_customer_group_show_tax'];
    }
// EOF Separate Pricing Per Customer
     for ($i=0, $n=sizeof($products); $i<$n; $i++) {
       $this->products[$index] = array('qty' => $products[$i]['quantity'],

 

your line 317, inserted

            $attributes = tep_db_fetch_array($attributes_query);
// BOF Separate Pricing Per Customer attribute_groups mod
 if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
   $attributes_group_query = tep_db_query("select pag.options_values_price, pag.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa left join " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " pag using(products_attributes_id) where pa.products_id = '" . tep_get_prid($products[$i]['id']) . "' and pa.options_id = '" . (int)$option . "' and pa.options_values_id = '" . (int)$value . "' and pag.customers_group_id = '" . (int)$_SESSION['sppc_customer_group_id'] . "'");
	 if ($attributes_group = tep_db_fetch_array($attributes_group_query)) {
		 $attributes['options_values_price'] = $attributes_group['options_values_price'];
		 $attributes['price_prefix'] = $attributes_group['price_prefix'];
	 }
 }
// EOF Separate Pricing Per Customer attribute_groups mod

           $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'],
                                                                    'value' => $attributes['products_options_values_name'],

 

line 334, modified

yours

        if (DISPLAY_PRICE_WITH_TAX == 'true') {

mine

        if ((DISPLAY_PRICE_WITH_TAX == 'true') && ($customer_group_show_tax == '1')) { // SPPC, show_tax modification

 

line 355, modified

yours

      if (DISPLAY_PRICE_WITH_TAX == 'true') {

mine

      if ((DISPLAY_PRICE_WITH_TAX == 'true') && ($customer_group_show_tax == '1')) { // SPPC, show_tax modification

-Dave

Link to comment
Share on other sites

None of those changes should affect the vendors_id. So, we're off to the Cart class. In catalog/includes/classes/shopping_cart.php, verify this code (lines 482-512 in the distribution)

        $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_length, p.products_width, p.products_height, p.products_ready_to_ship, p.products_tax_class_id, v.vendors_id, v.vendors_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_VENDORS . " v where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and v.vendors_id = p.vendors_id and pd.language_id = '" . (int)$languages_id . "'");
       if ($products = tep_db_fetch_array($products_query)) {
         $prid = $products['products_id'];
         $products_price = $products['products_price'];

         $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
         if (tep_db_num_rows($specials_query)) {
           $specials = tep_db_fetch_array($specials_query);
           $products_price = $specials['specials_new_products_price'];
         }

         $products_array[] = array('id' => $products_id,
                                   'name' => $products['products_name'],
                                   'model' => $products['products_model'],
                                   'image' => $products['products_image'],
                                   'price' => $products_price,
                                   'quantity' => $this->contents[$products_id]['qty'],
                                   'weight' => $products['products_weight'],
//upsxml dimensions start
                                   'length' => ($products['product_free_shipping'] == '1' ? 0 : $products['products_length']),
         			                    'width' => ($products['product_free_shipping'] == '1' ? 0 : $products['products_width']),
         			                    'height' => ($products['product_free_shipping'] == '1' ? 0 : $products['products_height']),
//uspxml dimensions end
                                   'ready_to_ship' => $products['products_ready_to_ship'],
                                   'final_price' => ($products_price + $this->attributes_price($products_id)),
                                   'tax_class_id' => $products['products_tax_class_id'],
//MVS start
                                   'vendors_id' => $products['vendors_id'],
                                   'vendors_name' => $products['vendors_name'],
//MVS end
                                   'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''));

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I remember that this file was one of the more tricky ones... Here is what I have in that section:

 

//MVS - added function to only retrieve specific vendors products
   function get_vendors_products($vendor) {
     global $languages_id;

     if (!is_array($this->contents)) return false;

     $products_array = array();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
//MVS - upxml start - added v.vendors_id, v.vendors_name, and v.vendors_id = p.vendors_id to  v.vendors_id = '" . $vendor . "' and p.vendors_id = '" . $vendor . "'
//upsxml dimensions start - added  p.products_length, p.products_width, p.products_height, p.products_ready_to_ship, 
       $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_length, p.products_width, p.products_height, p.products_ready_to_ship, p.products_tax_class_id, v.vendors_id, v.vendors_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_VENDORS . " v where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and v.vendors_id = '" . $vendor . "' and p.vendors_id = '" . $vendor . "' and pd.language_id = '" . (int)$languages_id . "'");
       //upsxml dimensions end
       //MVS end
       if ($products = tep_db_fetch_array($products_query)) {
         $prid = $products['products_id'];
         $products_price = $products['products_price'];

// rem out for SPPC below
/*          $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
         if (tep_db_num_rows($specials_query)) {
           $specials = tep_db_fetch_array($specials_query);
           $products_price = $specials['specials_new_products_price'];
         } */

// BOF Separate Pricing Per Customer - replaces above
  $specials_price = tep_get_products_special_price($prid);
 if (tep_not_null($specials_price)) {
 $products_price = $specials_price;
     } elseif ($this->cg_id != 0){
       $customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$prid . "' and customers_group_id =  '" . $this->cg_id . "'");
       if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
       $products_price = $customer_group_price['customers_group_price'];
       }
 }
// EOF Separate Pricing Per Customer


         $products_array[] = array('id' => $products_id,
                                   'name' => $products['products_name'],
                                   'model' => $products['products_model'],
                                   'image' => $products['products_image'],
                                   'price' => $products_price,
                                   'quantity' => $this->contents[$products_id]['qty'],
                                   'weight' => $products['products_weight'],
//upsxml dimensions start
                                   'length' => ($products['product_free_shipping'] == '1' ? 0 : $products['products_length']),
         			                    'width' => ($products['product_free_shipping'] == '1' ? 0 : $products['products_width']),
         			                    'height' => ($products['product_free_shipping'] == '1' ? 0 : $products['products_height']),
         			                    'ready_to_ship' => $products['products_ready_to_ship'],
//upsxml dimensions end
                                   'final_price' => ($products_price + $this->attributes_price($products_id)),
                                   'tax_class_id' => $products['products_tax_class_id'],
                                   //MVS start
                                   'vendors_id' => $products['vendors_id'],
                                   'vendors_name' => $products['vendors_name'],
                                   //MVS end
                                   'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''));
       }
     }

     return $products_array;
   }
//MVS - upsxml end

-Dave

Link to comment
Share on other sites

I tried this in catalog/includes/classes/shopping_cart.php

 

         $products_array[] = array('id' => $products_id,
                                   'name' => $products['products_name'],
                                   'model' => $products['products_model'],
                                   'image' => $products['products_image'],
                                   'price' => $products_price,
                                   'quantity' => $this->contents[$products_id]['qty'],
                                   'weight' => $products['products_weight'],
//upsxml dimensions start
                                   'length' => ($products['product_free_shipping'] == '1' ? 0 : $products['products_length']),
         			                    'width' => ($products['product_free_shipping'] == '1' ? 0 : $products['products_width']),
         			                    'height' => ($products['product_free_shipping'] == '1' ? 0 : $products['products_height']),
         			                    'ready_to_ship' => $products['products_ready_to_ship'],
//upsxml dimensions end
                                   'final_price' => ($products_price + $this->attributes_price($products_id)),
                                   'tax_class_id' => $products['products_tax_class_id'],
                                   //MVS start
                                   'vendors_id' => $products['vendors_id'],
                                   'vendors_name' => $products['vendors_name'],
                                   //MVS end
                                   'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''));
print '<pre>';
print_r ($sql_data_array);
print '</pre>';
exit;
       }
     }

     return $products_array;
   }
//MVS - upsxml end

 

and ran a test order. There was never an array visible and the exit; never was parsed... The order completed. Does this tell us something is wrong here? the files 861 lines so I'll not do that.

 

Thank you for the help

-Dave

Link to comment
Share on other sites

It can be tricky printing something out in a class. You have to find out where the class method is called and look for the output there. In any case, we don't need the whole array, just the vendors_id. That's taken from the database. So now, look at your products table and confirm that you have a value for vendors_id for every product in the table.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

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