Greetings;
I am on Magento 1.7.0.2 and ShipSync v5. I am not able to retrieve rates for international/foreign customers. We are selling bundled products. I am based in the USA. I am logging the FedEx API. The Customs Value is always showing as 0 for each line item in the API. I have traced down the PHP functions...
If we go to /public_html/app/code/community/IllApps/Shipsync/Model/Shipping/Carrier/Fedex/Rate.php and go to line 455 we see:
'CustomsValue' => array(
'Currency' => $this->getCurrencyCode(),
'Amount' => sprintf('%01.2f', $item['value'] * $item['qty_to_ship'])
)
If we trace through the code, $item comes from a call to getParsedItems, so now we go to /public_html/app/code/community/IllApps/Shipsync/Model/Shipping/Package.php go to line 152
public function getParsedItems($items, $toShip = false)
{
return Mage::getModel('shipsync/shipping_package_item')->getParsedItems($items, $toShip);
}
And now if we go to /app/code/community/IllApps/Shipsync/Model/Shipping/Package/Item.php and insert a Mage::log() commands...
...
$_items[$i]['id'] = $item->getItemId();
$_items[$i]['product_id'] = $item->getProductId();
$_items[$i]['name'] = $item->getName();
$_items[$i]['weight'] = $item->getIsQtyDecimal() ? $item->getQtyOrdered() * $itemWeight : $itemWeight;
$_items[$i]['qty'] = $item->getQtyOrdered();
$_items[$i]['value'] = $product->getPrice();
$_items[$i]['special'] = $product->getSpecialPackaging();
$_items[$i]['free_shipping'] = $product->getFreeShipping();
$_items[$i]['alt_origin'] = 0; //(int) $product->getProductOrigin();
$_items[$i]['is_decimal_qty'] = $item->getIsQtyDecimal();
Mage::log($item->getPrice());
Mage::log($product->getPrice());
...
The output for $product->getPrice(); is ZERO.?
The output for $item->getPrice(); is the correct cost of the item in your currency.
It seems the source of my problem, therefore, is on line 78 of the Item.php
In my case, to fix my problem, I have edited line 78 in that file.
BEFORE:
$_items[$i]['value'] = $product->getPrice();
AFTER:
$_items[$i]['value'] = $item->getPrice();
Now, the proper customs value is passed to FedEx for each item, instead of a zero customs value. My international customers are now able to retrieve shipping quotes.
I am not a coder, so please, let me know if you have suggestions for a proper fix. This is just a hack/fix that I have done to get my own cart working again, but would be interesting in knowing what the robust solution would be.