Jump to content

Only Appears The Common Shipping Method


Recommended Posts

Hi,

I have two products with differents shipping methods.

1. Carrier A, and pick up at store

2. Carrier B, and pick up at store.

 

It only appears pick up at the store as shipping method because the two products have the same type of shipping.

But if

 

1.Carrier A and pick up

2. Carrier B.

 

It appears Carrier B + pickup at the store as shipping method.

 

How can i make in the first example, to show all the combinations at the shipping method?

 

Carrier A + B or, Carrier B + pick up at the store, or Carrier B + pick up at the store?

 

thanks

Edited by Bicss (see edit history)
Link to comment
Share on other sites

It used to work differently, but then they introduced some logic to group carriers in the smallest possible number. I am afraid it's way too complicated to explain, it took like 2 months and results were a bit buggy anyway. If you really want it, start by having a look at getAvailableCarrierList in the Carrier class

Link to comment
Share on other sites

After trying some options:

Changing on classes/cart.php

Erasing the "break" at the end, appears multiple combinations on shipping method but 2shipping method combining with the third, not  one shipping method combining with second one.

 

Any idea why?

 

Thanks

 

// Step 4 : merge product from grouped_by_carriers into $package to minimize the number of package
foreach ($grouped_by_carriers as $id_address_delivery => $products_in_stock_list)
{
if (!isset($package_list[$id_address_delivery]))
$package_list[$id_address_delivery] = array(
'in_stock' => array(),
'out_of_stock' => array(),
);
 
foreach ($products_in_stock_list as $key => $warehouse_list)
{
if (!isset($package_list[$id_address_delivery][$key]))
$package_list[$id_address_delivery][$key] = array();
// Count occurance of each carriers to minimize the number of packages
$carrier_count = array();
foreach ($warehouse_list as $id_warehouse => $products_grouped_by_carriers)
{
foreach ($products_grouped_by_carriers as $data)
{
foreach ($data['carrier_list'] as $id_carrier)
{
if (!isset($carrier_count[$id_carrier]))
$carrier_count[$id_carrier] = 0;
$carrier_count[$id_carrier]++;
}
}
}
arsort($carrier_count);
foreach ($warehouse_list as $id_warehouse => $products_grouped_by_carriers)
{
if (!isset($package_list[$id_address_delivery][$key][$id_warehouse]))
$package_list[$id_address_delivery][$key][$id_warehouse] = array();
foreach ($products_grouped_by_carriers as $data)
{
foreach ($carrier_count as $id_carrier => $rate)
{
if (in_array($id_carrier, $data['carrier_list']))
{
if (!isset($package_list[$id_address_delivery][$key][$id_warehouse][$id_carrier]))
$package_list[$id_address_delivery][$key][$id_warehouse][$id_carrier] = array(
'carrier_list' => $data['carrier_list'],
'warehouse_list' => $data['warehouse_list'],
'product_list' => array(),
);
 
$package_list[$id_address_delivery][$key][$id_warehouse][$id_carrier]['carrier_list'] =
array_intersect($package_list[$id_address_delivery][$key][$id_warehouse][$id_carrier]['carrier_list'], $data['carrier_list']);
 
$package_list[$id_address_delivery][$key][$id_warehouse][$id_carrier]['product_list'] =
array_merge($package_list[$id_address_delivery][$key][$id_warehouse][$id_carrier]['product_list'], $data['product_list']);
 
break;
}
}
}
}
 
}
}

post-957417-0-45651300-1451498016_thumb.jpg

Edited by Bicss (see edit history)
Link to comment
Share on other sites

If i change array_intersect($package_list[$id_address_delivery][$key][$id_warehouse][$id_carrier]['carrier_list'], $data['carrier_list']);

fo
array_merge($package_list[$id_address_delivery][$key][$id_warehouse][$id_carrier]['carrier_list'], $data['carrier_list']);
 
Appears all the carriers but not combined
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...