Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Multi_Vendor_Shipping new thread


blucollarguy

Recommended Posts

Ok I think the admin side is good now I am getting these errors:

 

Warning: substr() expects parameter 1 to be string, array given in /home/giftboun/public_html/includes/classes/vendor_shipping.php on line 46

Warning: strpos() expects parameter 1 to be string, array given in /home/giftboun/public_html/includes/modules/order_total/ot_shipping.php on line 48

 

here is what I put on checkout_process.php

 

 print 'Vendor Shipping: ' . SELECT_VENDOR_SHIPPING . "<br>\n";
  print 'Array Vendor Shipping: <pre>';
  print_r ($shipping);
  print '</pre>' . "<br>\n";
  print 'Vendor Count: ' . count ($shipping['vendor']) . "<br>\n";
  print 'Cart Vendor Count: ' . count ($cart->vendor_shipping) . "<br>\n";
  print 'Orders ID: ' . ($orders_id) . "<br>\n";
 

 

here is the results:

Vendor Shipping: true
Array Vendor Shipping:

Array
(
    [id] => Array
        (
        )

    [title] => Combined Shipping
    [cost] => 10
    [shipping_tax_total] => 0
    [vendor] => Array
        (
            [3] => Array
                (
                    [id] => spu_spu
                    [title] => Pickup during regular business hours.
                    [ship_tax] => 0
                    [products] => Array
                        (
                            [0] => 1{4}1{3}5
                        )

                    [cost] => 5
                )

            [1] => Array
                (
                    [id] => flat_flat
                    [title] => Best Way
                    [ship_tax] => 0
                    [products] => Array
                        (
                            [0] => 2{4}3{3}6
                        )

                    [cost] => 5
                )

        )

)


Vendor Count: 2
Cart Vendor Count: 2
Orders ID: 

it looks like it's not passing the orders_id ?? could that be the problem everything else looks ok to me

Edited by drillsar
Link to comment
Share on other sites

What I did was this and I have no idea what this error means: Warning: Illegal string offset 'id' in /home/giftboun/public_html/includes/classes/vendor_shipping.php on line 44
checkout_shipping.php
 

print_r($module['id']);
print_r($PHP_SELF);

      $include_modules = array();
      if ( (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules)) ) { //original
//    if ( (is_string($module) && (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $modules_array))) ) { //changed
        $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')),
                                   'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)));
      } else {
        reset($modules_array);
        foreach ($installed_modules_array as $value) {
          $class = substr($value, 0, strrpos($value, '.'));
          $include_modules[] = array('class' => $class,
                                     'file' => $value);
        }//foreach
      }//if tep_not_null

Edited by drillsar
Link to comment
Share on other sites

Ok I read a post back that this is the solution or no?

 

Change vendor_shipping.php

 if ( (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules)) ) {

to:

if ( (is_string($module) && (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules))) ) {
Link to comment
Share on other sites

I think the problem is here this is where it is supposed to be set. However, in php 5.5 it's not working. In PHP 4 it was so there has to be something I think wrong with this code?

 

i used print and the result was:

Warning:  Illegal string offset 'id' in /home/giftboun/public_html/checkout_shipping.php on line 168
if (SELECT_VENDOR_SHIPPING == 'true') {
        $total_shipping_cost = 0;
        $shipping_title = MULTIPLE_SHIP_METHODS_TITLE;
        $vendor_shipping = $cart->vendor_shipping;
        $shipping = array();
        
        foreach ($vendor_shipping as $vendor_id => $vendor_data) {
          $products_shipped = $_POST['products_' . $vendor_id];
          $products_array = explode ("_", $products_shipped);

          $shipping_data = $_POST['shipping_' . $vendor_id];
          $shipping_array = explode ("_", $shipping_data);
          $module = $shipping_array[0];
          $method = $shipping_array[1];
          $ship_tax = $shipping_array[2];

          if ( is_object($$module) || ($module == 'free') ) {
            if ($module == 'free') {
              $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
              $quote[0]['methods'][0]['cost'] = '0';
            } else {
              $total_weight = $vendor_shipping[$vendor_id]['weight'];
              $shipping_weight = $total_weight;
              $cost = $vendor_shipping[$vendor_id]['cost'];
              $total_count = $vendor_shipping[$vendor_id]['qty'];
              $quote = $shipping_modules->quote($method, $module, $vendor_id);


            }
            if (isset($quote['error'])) {
              tep_session_unregister('shipping');
            } else {
              if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) {
                $output[$vendor_id] = array('id' => $module . '_' . $method,
                                            'title' => $quote[0]['methods'][0]['title'],
                                            'ship_tax' => $ship_tax,
                                            'products' => $products_array,
                                            'cost' => $quote[0]['methods'][0]['cost']
                                           );
                $total_ship_tax += $ship_tax;
                $total_shipping_cost += $quote[0]['methods'][0]['cost'];
				print '$include_modules[]: <pre>';
print_r($module['id']);
print '</pre>' . "<br />\n";
              }//if isset
            }//if isset
          }//if is_object
        }//foreach
Edited by drillsar
Link to comment
Share on other sites

Jim,

 

Can I confirm these two changes?

 

in checkout_process.php and checkout_confirmation.php

 

in checkout process.php

if (($total_weight > 0 ) || (SELECT_VENDOR_SHIPPING == 'true') ) {

to:

if (($total_weight > 0 ) && (SELECT_VENDOR_SHIPPING == 'true') ) {

in checkout_confirmation.php

 

change this line:

if (($total_weight > 0 ) || (SELECT_VENDOR_SHIPPING == 'true') ) {

to:

if (($total_weight > 0 ) &&! (SELECT_VENDOR_SHIPPING == 'true') ) {
Link to comment
Share on other sites

I am tired messed up thinking of something else lol:

 

In both checkout_process.php and checkout_confirmation this line needs to be changed I think:

if (($total_weight > 0 ) || (SELECT_VENDOR_SHIPPING == 'true') ) {
    include_once (DIR_WS_CLASSES . 'vendor_shipping.php');
  } elseif ( ($total_weight > 0 ) || (SELECT_VENDOR_SHIPPING == 'false') ) {
    include_once (DIR_WS_CLASSES . 'shipping.php');
  }

I believe thats a errror. Not sure what to change it to though. I almost finally getting done. lol

Edited by drillsar
Link to comment
Share on other sites

It's working as is in at least one site, so that's not going to help you any. But yes, I think the 'or' should be changed to 'and' in both tests.

 

Regards

Jim

Edited by kymation

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

Link to comment
Share on other sites

Ok found a problem here:

 

in admin/categories.php the line is:

if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) {
      $product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");

should be:

 if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) { //might have to change
//MVS 
     //      $product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.vendors_prod_id, p.products_image, p.products_price, p.vendors_product_price, p.products_weight, p.vendors_prod_comments, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.vendors_id, p.manufacturers_id, p.products_fxf_class, p.products_fxf_desc, p.products_fxf_nmfc, p.products_fxf_haz, p.products_fxf_freezable from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
      $product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.vendors_prod_id, p.products_image, p.products_price, p.vendors_product_price, p.products_weight, p.vendors_prod_comments, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.vendors_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
      
Link to comment
Share on other sites

here is another fix in admin/prod_by_vendors.php now the list gets populated

 

change:

 $vendors_id = 1;
  if (isset ($_GET['vendors_id']) && $_GET['vendors_id'] != '') {
    $vendors_id = (int) $_GET['vendors_id'];

to:

$vendors_id = 1;
  if (isset ($_POST['vendors_id']) && $_POST['vendors_id'] != '') { 
  $vendors_id = (int) $_POST['vendors_id'];
  }
Link to comment
Share on other sites

Jim,

 

I am getting the order shown on when I click on vendor_manager.php. However, when I go to orders_by_vendor.php nothing shows up. I am still getting errors in the catalog section but I am figuring them out.

 

Is there a bug that u know of with orders_by_vendor.php? I don't know what to look for. Thanks

Link to comment
Share on other sites

ok I will try and fix it but that is the least of my worries.

 

I tested php 5.5 and there has to be something wrong with a code somewhere when going to this version. I am suspecting checkout_process or checkout_shipping. Furthermore, it wont let me continue and dies at checkout_process. However, When I go back to PHP 5.4 the only error I get is this:

 

Warning: substr() expects parameter 1 to be string, array given in /home/giftboun/public_html/includes/classes/vendor_shipping.php on line 46

Warning: strpos() expects parameter 1 to be string, array given in /home/giftboun/public_html/includes/modules/order_total/ot_shipping.php on line 48

 

in checkout_confirmation.php which I think I may know where the problem is. I will print test results in a sec. With this contribution it looks like PHP 5.5 is indeed a major problem in the code I think

 

I can fully checkout though and get the order in my admin side

Edited by drillsar
Link to comment
Share on other sites

OK I almost have order_by_vendor.php working. However, it only shows vendor #1. I am guessing this is why?

 

I replaced more lines of the code that I got on this forum. If u want I can show you whole file. It's just showing one vendor though so a little tweaking

 

I replaced this line:

$vendors_id = 0;
  if (isset ($_GET['vendors_id'])) {
    $vendors_id = (int) $_GET['vendors_id'];
  }

  $line_filter = 'desc';
  if (isset ($_GET['line']) && $_GET['line'] == 'asc') {
    $line_filter == $_GET['line'];
  }

with this:

if (isset ($vendors_id)) {

} else {

$vendors_id = 1;
}
  if (isset ($_GET['line_filter'])) {

$line_filter == $_GET['line_filter'];

} else {
$line_filter = 'desc';
}
Edited by drillsar
Link to comment
Share on other sites

On a different note:

 

I searched the forums and you mentioned this in checkout_shipping.php

 

with the fix I no longer get that error:

 

Warning: substr() expects parameter 1 to be string, array given in /home/giftboun/public_html/includes/classes/vendor_shipping.php on line 46

Warning: strpos() expects parameter 1 to be string, array given in /home/giftboun/public_html/includes/modules/order_total/ot_shipping.php on line 48

 

I guess that is the fix?

 

 

is this a indeed bug on PHP 5.4?

 

All references of this line:

$shipping = array('id' => $shipping

to:

$shipping = array('id' => $SESSION['shipping']
Link to comment
Share on other sites

I wanted to ask you this; wouldn't it be better if we change both of these line in checkout_confirmation.php and checkout_process.php

 

The line I am referring to is this:

if (($total_weight > 0 ) || (SELECT_VENDOR_SHIPPING == 'true') ) {
    include_once (DIR_WS_CLASSES . 'vendor_shipping.php');
  } elseif ( ($total_weight > 0 ) || (SELECT_VENDOR_SHIPPING == 'false') ) {
    include_once (DIR_WS_CLASSES . 'shipping.php');

to this as some people actually don't use weight at all

if (SELECT_VENDOR_SHIPPING == 'true') {

   include_once (DIR_WS_CLASSES . 'vendor_shipping.php');

}else{

  include_once (DIR_WS_CLASSES . 'shipping.php');

}
Edited by drillsar
Link to comment
Share on other sites

The only error I am getting now is it is complaining to enter payment when I didn't even get to that yet. Any Idea where to look for that. I doubt I can use a print_r statement for that. I am thinking of uploading stock oscommerce and uncomment some lines in that area to trigger error. Not sure what else to do.

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