Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. public function estimatedDeliveryDateModifierForProduct($product, $qtyInCart) {
  2.  
  3. //Is the product a pre order product?
  4. if ($preOrderDate = $product->getPreOrderDate())
  5. {
  6. $diff = date_diff(
  7. new DateTime,
  8. new DateTime($preOrderDate)
  9. );
  10.  
  11. return $diff->format('%a');
  12. }
  13.  
  14. //If it has to be backordered...
  15. if ($product->getQty() < $qtyInCart) {
  16. if (empty($product->getSupplierId())) {
  17. return Mage::getStoreConfig('supplier/stock_file/delivery_modifier');
  18. } else {
  19. return Mage::getModel('supplier/supplier')->getCalDeliveryTime($product->getSupplierId());
  20. }
  21. }
  22.  
  23. if (Mage::Helper('catalog')->productIsBike($product)) {
  24. return 2;
  25. }
  26.  
  27. //If we got here, the item is in stock and it
  28. //is not a bike. We can ship it in 1 day.
  29. return 1;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement