Version Notes
• Made compatible with 1.1 Beta.
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | Minerva_Shipping |
| Version | 0.9.0 |
| Comparing to | |
| See all releases | |
Code changes from version 0.8.0 to 0.9.0
- app/code/community/Mage/Sales/Model/Convert/Order.php +169 -145
- app/code/community/Mage/Sales/Model/Convert/Quote.php +137 -112
- app/code/community/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Shipping.php +38 -0
- app/code/community/Mage/Sales/Model/Quote/Address/Total/Shipping.php +76 -16
- app/design/frontend/default/minerva_default/template/checkout/cart/shipping.phtml +11 -2
- app/design/frontend/default/minerva_default/template/checkout/onepage/shipping_method/available.phtml +12 -1
- package.xml +5 -6
app/code/community/Mage/Sales/Model/Convert/Order.php
CHANGED
|
@@ -44,45 +44,47 @@ class Mage_Sales_Model_Convert_Order extends Varien_Object
|
|
| 44 |
* Base Data
|
| 45 |
*/
|
| 46 |
->setStoreId($order->getStoreId())
|
| 47 |
-
->setOrderId($order->getId())
|
| 48 |
|
| 49 |
-
|
| 50 |
-
* Customer data
|
| 51 |
-
*/
|
| 52 |
-
->setCustomerId($order->getCustomerId())
|
| 53 |
-
->setCustomerEmail($order->getCustomerEmail())
|
| 54 |
-
->setCustomerGroupId($order->getCustomerGroupId())
|
| 55 |
-
->setCustomerTaxClassId($order->getCustomerTaxClassId())
|
| 56 |
-
/**
|
| 57 |
-
* Not use note from previos order
|
| 58 |
-
*/
|
| 59 |
-
//->setCustomerNote($order->getCustomerNote())
|
| 60 |
-
//->setCustomerNoteNotify($order->getCustomerNoteNotify())
|
| 61 |
-
->setCustomerIsGuest($order->getCustomerIsGuest())
|
| 62 |
-
|
| 63 |
-
/**
|
| 64 |
-
* Currency data
|
| 65 |
-
*/
|
| 66 |
-
->setBaseCurrencyCode($order->getBaseCurrencyCode())
|
| 67 |
-
->setStoreCurrencyCode($order->getStoreCurrencyCode())
|
| 68 |
-
->setQuoteCurrencyCode($order->getOrderCurrencyCode())
|
| 69 |
-
->setStoreToBaseRate($order->getStoreToBaseRate())
|
| 70 |
-
->setStoreToQuoteRate($order->getStoreToOrderRate())
|
| 71 |
-
|
| 72 |
-
/**
|
| 73 |
-
* Totals data
|
| 74 |
-
*/
|
| 75 |
-
->setGrandTotal($order->getGrandTotal())
|
| 76 |
-
->setBaseGrandTotal($order->getBaseGrandTotal())
|
| 77 |
-
|
| 78 |
-
/**
|
| 79 |
-
* Another data
|
| 80 |
-
*/
|
| 81 |
-
->setCouponCode($order->getCouponCode())
|
| 82 |
-
->setGiftcertCode($order->getGiftcertCode())
|
| 83 |
-
->setAppliedRuleIds($order->getAppliedRuleIds());
|
| 84 |
-
//->collectTotals();
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
Mage::dispatchEvent('sales_convert_order_to_quote', array('order'=>$order, 'quote'=>$quote));
|
| 88 |
return $quote;
|
|
@@ -97,27 +99,29 @@ class Mage_Sales_Model_Convert_Order extends Varien_Object
|
|
| 97 |
public function toQuoteShippingAddress(Mage_Sales_Model_Order $order)
|
| 98 |
{
|
| 99 |
$address = $this->addressToQuoteAddress($order->getShippingAddress());
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
->
|
| 105 |
-
|
| 106 |
-
->
|
| 107 |
-
|
| 108 |
-
->
|
| 109 |
-
->
|
| 110 |
-
->
|
| 111 |
-
->
|
| 112 |
-
->
|
| 113 |
-
|
| 114 |
-
->
|
| 115 |
-
|
| 116 |
-
->
|
| 117 |
-
->
|
| 118 |
-
->
|
| 119 |
-
->
|
| 120 |
-
->
|
|
|
|
|
|
|
| 121 |
return $address;
|
| 122 |
}
|
| 123 |
|
|
@@ -133,18 +137,23 @@ class Mage_Sales_Model_Convert_Order extends Varien_Object
|
|
| 133 |
->setStoreId($address->getStoreId())
|
| 134 |
->setAddressType($address->getAddressType())
|
| 135 |
->setCustomerId($address->getCustomerId())
|
| 136 |
-
->setCustomerAddressId($address->getCustomerAddressId())
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
->
|
| 140 |
-
->
|
| 141 |
-
->
|
| 142 |
-
->
|
| 143 |
-
->
|
| 144 |
-
->
|
| 145 |
-
->
|
| 146 |
-
->
|
| 147 |
-
->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
return $quoteAddress;
|
| 149 |
}
|
| 150 |
|
|
@@ -161,22 +170,24 @@ class Mage_Sales_Model_Convert_Order extends Varien_Object
|
|
| 161 |
}
|
| 162 |
|
| 163 |
$quotePayment->setStoreId($payment->getStoreId())
|
| 164 |
-
->setCustomerPaymentId($payment->getCustomerPaymentId())
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
->
|
| 168 |
-
->
|
| 169 |
-
->
|
| 170 |
-
->
|
| 171 |
-
->
|
| 172 |
-
->
|
| 173 |
-
->
|
| 174 |
-
->
|
| 175 |
-
|
| 176 |
-
->
|
| 177 |
-
|
| 178 |
-
->
|
| 179 |
-
|
|
|
|
|
|
|
| 180 |
return $quotePayment;
|
| 181 |
}
|
| 182 |
|
|
@@ -189,28 +200,29 @@ class Mage_Sales_Model_Convert_Order extends Varien_Object
|
|
| 189 |
public function itemToQuoteItem(Mage_Sales_Model_Order_Item $item)
|
| 190 |
{
|
| 191 |
$quoteItem = Mage::getModel('sales/quote_item')
|
| 192 |
-
->setStoreId($item->getStoreId())
|
| 193 |
->setQuoteItemId($item->getId())
|
| 194 |
->setProductId($item->getProductId())
|
| 195 |
-
->
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
->
|
| 199 |
-
->
|
| 200 |
-
->
|
| 201 |
-
->
|
| 202 |
-
->
|
| 203 |
-
->
|
| 204 |
-
->
|
| 205 |
-
->
|
| 206 |
-
->
|
| 207 |
-
->
|
| 208 |
-
->
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
->
|
| 212 |
-
->
|
| 213 |
-
|
|
|
|
| 214 |
|
| 215 |
return $quoteItem;
|
| 216 |
}
|
|
@@ -228,12 +240,14 @@ class Mage_Sales_Model_Convert_Order extends Varien_Object
|
|
| 228 |
->setStoreId($order->getStoreId())
|
| 229 |
->setCustomerId($order->getCustomerId())
|
| 230 |
->setBillingAddressId($order->getBillingAddressId())
|
| 231 |
-
->setShippingAddressId($order->getShippingAddressId())
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
->
|
| 235 |
-
->
|
| 236 |
-
->
|
|
|
|
|
|
|
| 237 |
|
| 238 |
return $invoice;
|
| 239 |
}
|
|
@@ -248,13 +262,15 @@ class Mage_Sales_Model_Convert_Order extends Varien_Object
|
|
| 248 |
{
|
| 249 |
$invoiceItem = Mage::getModel('sales/order_invoice_item');
|
| 250 |
$invoiceItem->setOrderItem($item)
|
| 251 |
-
->setProductId($item->getProductId())
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
->
|
| 255 |
-
->
|
| 256 |
-
->
|
| 257 |
-
->
|
|
|
|
|
|
|
| 258 |
|
| 259 |
return $invoiceItem;
|
| 260 |
}
|
|
@@ -272,12 +288,14 @@ class Mage_Sales_Model_Convert_Order extends Varien_Object
|
|
| 272 |
->setStoreId($order->getStoreId())
|
| 273 |
->setCustomerId($order->getCustomerId())
|
| 274 |
->setBillingAddressId($order->getBillingAddressId())
|
| 275 |
-
->setShippingAddressId($order->getShippingAddressId())
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
->
|
| 279 |
-
->
|
| 280 |
-
->
|
|
|
|
|
|
|
| 281 |
|
| 282 |
return $shipment;
|
| 283 |
}
|
|
@@ -292,13 +310,15 @@ class Mage_Sales_Model_Convert_Order extends Varien_Object
|
|
| 292 |
{
|
| 293 |
$shipmentItem = Mage::getModel('sales/order_shipment_item');
|
| 294 |
$shipmentItem->setOrderItem($item)
|
| 295 |
-
->setProductId($item->getProductId())
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
->
|
| 299 |
-
->
|
| 300 |
-
->
|
| 301 |
-
->
|
|
|
|
|
|
|
| 302 |
|
| 303 |
return $shipmentItem;
|
| 304 |
}
|
|
@@ -316,12 +336,14 @@ class Mage_Sales_Model_Convert_Order extends Varien_Object
|
|
| 316 |
->setStoreId($order->getStoreId())
|
| 317 |
->setCustomerId($order->getCustomerId())
|
| 318 |
->setBillingAddressId($order->getBillingAddressId())
|
| 319 |
-
->setShippingAddressId($order->getShippingAddressId())
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
->
|
| 323 |
-
->
|
| 324 |
-
->
|
|
|
|
|
|
|
| 325 |
|
| 326 |
return $creditmemo;
|
| 327 |
}
|
|
@@ -336,13 +358,15 @@ class Mage_Sales_Model_Convert_Order extends Varien_Object
|
|
| 336 |
{
|
| 337 |
$creditmemoItem = Mage::getModel('sales/order_creditmemo_item');
|
| 338 |
$creditmemoItem->setOrderItem($item)
|
| 339 |
-
->setProductId($item->getProductId())
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
->
|
| 343 |
-
->
|
| 344 |
-
->
|
| 345 |
-
->
|
|
|
|
|
|
|
| 346 |
|
| 347 |
return $creditmemoItem;
|
| 348 |
}
|
| 44 |
* Base Data
|
| 45 |
*/
|
| 46 |
->setStoreId($order->getStoreId())
|
| 47 |
+
->setOrderId($order->getId());
|
| 48 |
|
| 49 |
+
Mage::helper('core')->copyFieldset('sales_convert_order', 'to_quote', $order, $quote);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
+
// /**
|
| 52 |
+
// * Customer data
|
| 53 |
+
// */
|
| 54 |
+
// ->setCustomerId($order->getCustomerId())
|
| 55 |
+
// ->setCustomerEmail($order->getCustomerEmail())
|
| 56 |
+
// ->setCustomerGroupId($order->getCustomerGroupId())
|
| 57 |
+
// ->setCustomerTaxClassId($order->getCustomerTaxClassId())
|
| 58 |
+
// /**
|
| 59 |
+
// * Not use note from previos order
|
| 60 |
+
// */
|
| 61 |
+
// //->setCustomerNote($order->getCustomerNote())
|
| 62 |
+
// //->setCustomerNoteNotify($order->getCustomerNoteNotify())
|
| 63 |
+
// ->setCustomerIsGuest($order->getCustomerIsGuest())
|
| 64 |
+
//
|
| 65 |
+
// /**
|
| 66 |
+
// * Currency data
|
| 67 |
+
// */
|
| 68 |
+
// ->setBaseCurrencyCode($order->getBaseCurrencyCode())
|
| 69 |
+
// ->setStoreCurrencyCode($order->getStoreCurrencyCode())
|
| 70 |
+
// ->setQuoteCurrencyCode($order->getOrderCurrencyCode())
|
| 71 |
+
// ->setStoreToBaseRate($order->getStoreToBaseRate())
|
| 72 |
+
// ->setStoreToQuoteRate($order->getStoreToOrderRate())
|
| 73 |
+
//
|
| 74 |
+
// /**
|
| 75 |
+
// * Totals data
|
| 76 |
+
// */
|
| 77 |
+
// ->setGrandTotal($order->getGrandTotal())
|
| 78 |
+
// ->setBaseGrandTotal($order->getBaseGrandTotal())
|
| 79 |
+
//
|
| 80 |
+
// /**
|
| 81 |
+
// * Another data
|
| 82 |
+
// */
|
| 83 |
+
// ->setCouponCode($order->getCouponCode())
|
| 84 |
+
// ->setGiftcertCode($order->getGiftcertCode())
|
| 85 |
+
// ->setAppliedRuleIds($order->getAppliedRuleIds());
|
| 86 |
+
// //->collectTotals();
|
| 87 |
+
//
|
| 88 |
|
| 89 |
Mage::dispatchEvent('sales_convert_order_to_quote', array('order'=>$order, 'quote'=>$quote));
|
| 90 |
return $quote;
|
| 99 |
public function toQuoteShippingAddress(Mage_Sales_Model_Order $order)
|
| 100 |
{
|
| 101 |
$address = $this->addressToQuoteAddress($order->getShippingAddress());
|
| 102 |
+
|
| 103 |
+
Mage::helper('core')->copyFieldset('sales_convert_order', 'to_quote_address', $order, $address);
|
| 104 |
+
// $address->setWeight($order->getWeight())
|
| 105 |
+
// ->setShippingMethod($order->getShippingMethod())
|
| 106 |
+
// ->setShippingDescription($order->getShippingDescription())
|
| 107 |
+
// ->setShippingDetails($order->getShippingDetails()) // added by Sherrie Rohde for Pickup at Event / Multiple Flatrates extension
|
| 108 |
+
// ->setShippingRate($order->getShippingRate())
|
| 109 |
+
//
|
| 110 |
+
// ->setSubtotal($order->getSubtotal())
|
| 111 |
+
// ->setTaxAmount($order->getTaxAmount())
|
| 112 |
+
// ->setDiscountAmount($order->getDiscountAmount())
|
| 113 |
+
// ->setShippingAmount($order->getShippingAmount())
|
| 114 |
+
// ->setGiftcertAmount($order->getGiftcertAmount())
|
| 115 |
+
// ->setCustbalanceAmount($order->getCustbalanceAmount())
|
| 116 |
+
// ->setGrandTotal($order->getGrandTotal())
|
| 117 |
+
//
|
| 118 |
+
// ->setBaseSubtotal($order->getBaseSubtotal())
|
| 119 |
+
// ->setBaseTaxAmount($order->getBaseTaxAmount())
|
| 120 |
+
// ->setBaseDiscountAmount($order->getBaseDiscountAmount())
|
| 121 |
+
// ->setBaseShippingAmount($order->getBaseShippingAmount())
|
| 122 |
+
// ->setBaseGiftcertAmount($order->getBaseGiftcertAmount())
|
| 123 |
+
// ->setBaseCustbalanceAmount($order->getBaseCustbalanceAmount())
|
| 124 |
+
// ->setBaseGrandTotal($order->getBaseGrandTotal());
|
| 125 |
return $address;
|
| 126 |
}
|
| 127 |
|
| 137 |
->setStoreId($address->getStoreId())
|
| 138 |
->setAddressType($address->getAddressType())
|
| 139 |
->setCustomerId($address->getCustomerId())
|
| 140 |
+
->setCustomerAddressId($address->getCustomerAddressId());
|
| 141 |
+
|
| 142 |
+
Mage::helper('core')->copyFieldset('sales_convert_order_address', 'to_quote_address', $address, $quoteAddress);
|
| 143 |
+
// ->setPrefix($address->getPrefix())
|
| 144 |
+
// ->setFirstname($address->getFirstname())
|
| 145 |
+
// ->setMiddlename($address->getMiddlename())
|
| 146 |
+
// ->setLastname($address->getLastname())
|
| 147 |
+
// ->setSuffix($address->setSuffix())
|
| 148 |
+
// ->setCompany($address->getCompany())
|
| 149 |
+
// ->setStreet($address->getStreet(-1))
|
| 150 |
+
// ->setCity($address->getCity())
|
| 151 |
+
// ->setRegion($address->getRegion())
|
| 152 |
+
// ->setRegionId($address->getRegionId())
|
| 153 |
+
// ->setPostcode($address->getPostcode())
|
| 154 |
+
// ->setCountryId($address->getCountryId())
|
| 155 |
+
// ->setTelephone($address->getTelephone())
|
| 156 |
+
// ->setFax($address->getFax());
|
| 157 |
return $quoteAddress;
|
| 158 |
}
|
| 159 |
|
| 170 |
}
|
| 171 |
|
| 172 |
$quotePayment->setStoreId($payment->getStoreId())
|
| 173 |
+
->setCustomerPaymentId($payment->getCustomerPaymentId());
|
| 174 |
+
|
| 175 |
+
Mage::helper('core')->copyFieldset('sales_convert_order_payment', 'to_quote_payment', $payment, $quotePayment);
|
| 176 |
+
// ->setMethod($payment->getMethod())
|
| 177 |
+
// ->setAdditionalData($payment->getAdditionalData())
|
| 178 |
+
// ->setPoNumber($payment->getPoNumber())
|
| 179 |
+
// ->setCcType($payment->getCcType())
|
| 180 |
+
// ->setCcNumberEnc($payment->getCcNumberEnc())
|
| 181 |
+
// ->setCcLast4($payment->getCcLast4())
|
| 182 |
+
// ->setCcOwner($payment->getCcOwner())
|
| 183 |
+
// ->setCcCidEnc($payment->getCcCidEnc())
|
| 184 |
+
// ->setCcExpMonth($payment->getCcExpMonth())
|
| 185 |
+
// ->setCcExpYear($payment->getCcExpYear())
|
| 186 |
+
//
|
| 187 |
+
// ->setCcSsIssue($payment->getCcSsIssue()) //for direct payment
|
| 188 |
+
// ->setCcSsStartMonth($payment->getCcSsStartMonth()) //for direct payment
|
| 189 |
+
// ->setCcSsStartYear($payment->getCcSsStartYear()) //for direct payment
|
| 190 |
+
// ;
|
| 191 |
return $quotePayment;
|
| 192 |
}
|
| 193 |
|
| 200 |
public function itemToQuoteItem(Mage_Sales_Model_Order_Item $item)
|
| 201 |
{
|
| 202 |
$quoteItem = Mage::getModel('sales/quote_item')
|
| 203 |
+
->setStoreId($item->getOrder()->getStoreId())
|
| 204 |
->setQuoteItemId($item->getId())
|
| 205 |
->setProductId($item->getProductId())
|
| 206 |
+
->setParentProductId($item->getParentProductId());
|
| 207 |
+
|
| 208 |
+
Mage::helper('core')->copyFieldset('sales_convert_order_item', 'to_quote_item', $item, $quoteItem);
|
| 209 |
+
// ->setSku($item->getSku())
|
| 210 |
+
// ->setName($item->getName())
|
| 211 |
+
// ->setDescription($item->getDescription())
|
| 212 |
+
// ->setWeight($item->getWeight())
|
| 213 |
+
// ->setCustomPrice($item->getPrice())
|
| 214 |
+
// ->setDiscountPercent($item->getDiscountPercent())
|
| 215 |
+
// ->setDiscountAmount($item->getDiscountAmount())
|
| 216 |
+
// ->setTaxPercent($item->getTaxPercent())
|
| 217 |
+
// ->setTaxAmount($item->getTaxAmount())
|
| 218 |
+
// ->setRowWeight($item->getRowWeight())
|
| 219 |
+
// ->setRowTotal($item->getRowTotal())
|
| 220 |
+
// ->setAppliedRuleIds($item->getAppliedRuleIds())
|
| 221 |
+
//
|
| 222 |
+
// ->setBaseDiscountAmount($item->getBaseDiscountAmount())
|
| 223 |
+
// ->setBaseTaxAmount($item->getBaseTaxAmount())
|
| 224 |
+
// ->setBaseRowTotal($item->getBaseRowTotal())
|
| 225 |
+
// ;
|
| 226 |
|
| 227 |
return $quoteItem;
|
| 228 |
}
|
| 240 |
->setStoreId($order->getStoreId())
|
| 241 |
->setCustomerId($order->getCustomerId())
|
| 242 |
->setBillingAddressId($order->getBillingAddressId())
|
| 243 |
+
->setShippingAddressId($order->getShippingAddressId());
|
| 244 |
+
|
| 245 |
+
Mage::helper('core')->copyFieldset('sales_convert_order', 'to_invoice', $order, $invoice);
|
| 246 |
+
// ->setBaseCurrencyCode($order->getBaseCurrencyCode())
|
| 247 |
+
// ->setStoreCurrencyCode($order->getStoreCurrencyCode())
|
| 248 |
+
// ->setOrderCurrencyCode($order->getOrderCurrencyCode())
|
| 249 |
+
// ->setStoreToBaseRate($order->getStoreToBaseRate())
|
| 250 |
+
// ->setStoreToOrderRate($order->getStoreToOrderRate());
|
| 251 |
|
| 252 |
return $invoice;
|
| 253 |
}
|
| 262 |
{
|
| 263 |
$invoiceItem = Mage::getModel('sales/order_invoice_item');
|
| 264 |
$invoiceItem->setOrderItem($item)
|
| 265 |
+
->setProductId($item->getProductId());
|
| 266 |
+
|
| 267 |
+
Mage::helper('core')->copyFieldset('sales_convert_order_item', 'to_invoice_item', $item, $invoiceItem);
|
| 268 |
+
// ->setName($item->getName())
|
| 269 |
+
// ->setSku($item->getSku())
|
| 270 |
+
// ->setDescription($item->getDescription())
|
| 271 |
+
// ->setPrice($item->getPrice())
|
| 272 |
+
// ->setBasePrice($item->getBasePrice())
|
| 273 |
+
// ->setCost($item->getCost());
|
| 274 |
|
| 275 |
return $invoiceItem;
|
| 276 |
}
|
| 288 |
->setStoreId($order->getStoreId())
|
| 289 |
->setCustomerId($order->getCustomerId())
|
| 290 |
->setBillingAddressId($order->getBillingAddressId())
|
| 291 |
+
->setShippingAddressId($order->getShippingAddressId());
|
| 292 |
+
|
| 293 |
+
Mage::helper('core')->copyFieldset('sales_convert_order', 'to_shipment', $order, $shipment);
|
| 294 |
+
// ->setBaseCurrencyCode($order->getBaseCurrencyCode())
|
| 295 |
+
// ->setStoreCurrencyCode($order->getStoreCurrencyCode())
|
| 296 |
+
// ->setOrderCurrencyCode($order->getOrderCurrencyCode())
|
| 297 |
+
// ->setStoreToBaseRate($order->getStoreToBaseRate())
|
| 298 |
+
// ->setStoreToOrderRate($order->getStoreToOrderRate());
|
| 299 |
|
| 300 |
return $shipment;
|
| 301 |
}
|
| 310 |
{
|
| 311 |
$shipmentItem = Mage::getModel('sales/order_shipment_item');
|
| 312 |
$shipmentItem->setOrderItem($item)
|
| 313 |
+
->setProductId($item->getProductId());
|
| 314 |
+
|
| 315 |
+
Mage::helper('core')->copyFieldset('sales_convert_order_item', 'to_shipment_item', $item, $shipmentItem);
|
| 316 |
+
// ->setName($item->getName())
|
| 317 |
+
// ->setSku($item->getSku())
|
| 318 |
+
// ->setDescription($item->getDescription())
|
| 319 |
+
// ->setPrice($item->getPrice())
|
| 320 |
+
// ->setBasePrice($item->getBasePrice())
|
| 321 |
+
// ->setWeight($item->getWeight());
|
| 322 |
|
| 323 |
return $shipmentItem;
|
| 324 |
}
|
| 336 |
->setStoreId($order->getStoreId())
|
| 337 |
->setCustomerId($order->getCustomerId())
|
| 338 |
->setBillingAddressId($order->getBillingAddressId())
|
| 339 |
+
->setShippingAddressId($order->getShippingAddressId());
|
| 340 |
+
|
| 341 |
+
Mage::helper('core')->copyFieldset('sales_convert_order', 'to_cm', $order, $creditmemo);
|
| 342 |
+
// ->setBaseCurrencyCode($order->getBaseCurrencyCode())
|
| 343 |
+
// ->setStoreCurrencyCode($order->getStoreCurrencyCode())
|
| 344 |
+
// ->setOrderCurrencyCode($order->getOrderCurrencyCode())
|
| 345 |
+
// ->setStoreToBaseRate($order->getStoreToBaseRate())
|
| 346 |
+
// ->setStoreToOrderRate($order->getStoreToOrderRate());
|
| 347 |
|
| 348 |
return $creditmemo;
|
| 349 |
}
|
| 358 |
{
|
| 359 |
$creditmemoItem = Mage::getModel('sales/order_creditmemo_item');
|
| 360 |
$creditmemoItem->setOrderItem($item)
|
| 361 |
+
->setProductId($item->getProductId());
|
| 362 |
+
|
| 363 |
+
Mage::helper('core')->copyFieldset('sales_convert_order_item', 'to_cm_item', $item, $creditmemoItem);
|
| 364 |
+
// ->setName($item->getName())
|
| 365 |
+
// ->setSku($item->getSku())
|
| 366 |
+
// ->setDescription($item->getDescription())
|
| 367 |
+
// ->setPrice($item->getPrice())
|
| 368 |
+
// ->setBasePrice($item->getBasePrice())
|
| 369 |
+
// ->setCost($item->getCost());
|
| 370 |
|
| 371 |
return $creditmemoItem;
|
| 372 |
}
|
app/code/community/Mage/Sales/Model/Convert/Quote.php
CHANGED
|
@@ -50,40 +50,46 @@ class Mage_Sales_Model_Convert_Quote extends Varien_Object
|
|
| 50 |
*/
|
| 51 |
->setIncrementId($quote->getReservedOrderId())
|
| 52 |
->setStoreId($quote->getStoreId())
|
| 53 |
-
->setQuoteId($quote->getId())
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
->
|
| 63 |
-
->
|
| 64 |
-
->
|
| 65 |
-
->
|
| 66 |
-
->
|
| 67 |
-
->
|
| 68 |
-
->
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
->
|
| 74 |
-
->
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
->
|
| 83 |
-
->
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
|
| 89 |
Mage::dispatchEvent('sales_convert_quote_to_order', array('order'=>$order, 'quote'=>$quote));
|
|
@@ -102,30 +108,32 @@ class Mage_Sales_Model_Convert_Quote extends Varien_Object
|
|
| 102 |
$order = $this->toOrder($address->getQuote());
|
| 103 |
}
|
| 104 |
|
| 105 |
-
$order
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
->
|
| 109 |
-
|
| 110 |
-
->
|
| 111 |
-
|
| 112 |
-
->
|
| 113 |
-
|
| 114 |
-
->
|
| 115 |
-
->
|
| 116 |
-
->
|
| 117 |
-
->
|
| 118 |
-
->
|
| 119 |
-
->
|
| 120 |
-
|
| 121 |
-
->
|
| 122 |
-
|
| 123 |
-
->
|
| 124 |
-
->
|
| 125 |
-
->
|
| 126 |
-
->
|
| 127 |
-
->
|
| 128 |
-
->
|
|
|
|
|
|
|
| 129 |
|
| 130 |
Mage::dispatchEvent('sales_convert_quote_address_to_order', array('address'=>$address, 'order'=>$order));
|
| 131 |
return $order;
|
|
@@ -143,18 +151,26 @@ class Mage_Sales_Model_Convert_Quote extends Varien_Object
|
|
| 143 |
->setStoreId($address->getStoreId())
|
| 144 |
->setAddressType($address->getAddressType())
|
| 145 |
->setCustomerId($address->getCustomerId())
|
| 146 |
-
->setCustomerAddressId($address->getCustomerAddressId())
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
->
|
| 150 |
-
->
|
| 151 |
-
->
|
| 152 |
-
->
|
| 153 |
-
->
|
| 154 |
-
->
|
| 155 |
-
->
|
| 156 |
-
->
|
| 157 |
-
->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
|
| 159 |
return $orderAddress;
|
| 160 |
}
|
|
@@ -169,24 +185,25 @@ class Mage_Sales_Model_Convert_Quote extends Varien_Object
|
|
| 169 |
{
|
| 170 |
$orderPayment = Mage::getModel('sales/order_payment')
|
| 171 |
->setStoreId($payment->getStoreId())
|
| 172 |
-
->setCustomerPaymentId($payment->getCustomerPaymentId())
|
| 173 |
-
|
| 174 |
-
->
|
| 175 |
-
->
|
| 176 |
-
->
|
| 177 |
-
->
|
| 178 |
-
->
|
| 179 |
-
->
|
| 180 |
-
->
|
| 181 |
-
->
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
->
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
->
|
| 188 |
-
|
| 189 |
-
|
|
|
|
| 190 |
|
| 191 |
Mage::dispatchEvent('sales_convert_quote_payment_to_order_payment',
|
| 192 |
array('order_payment' => $orderPayment, 'quote_payment' => $payment));
|
|
@@ -205,34 +222,42 @@ class Mage_Sales_Model_Convert_Quote extends Varien_Object
|
|
| 205 |
$orderItem = Mage::getModel('sales/order_item')
|
| 206 |
->setStoreId($item->getStoreId())
|
| 207 |
->setQuoteItemId($item->getId())
|
|
|
|
| 208 |
->setProductId($item->getProductId())
|
| 209 |
-
->
|
| 210 |
-
->
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
->
|
| 216 |
-
|
| 217 |
-
->
|
| 218 |
-
->
|
| 219 |
-
->
|
| 220 |
-
|
| 221 |
-
->
|
| 222 |
-
->
|
| 223 |
-
->
|
| 224 |
-
->
|
| 225 |
-
->
|
| 226 |
-
|
| 227 |
-
->
|
| 228 |
-
->
|
| 229 |
-
->
|
| 230 |
-
->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
|
| 232 |
if (!$item->getNoDiscount()) {
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
->
|
|
|
|
| 236 |
}
|
| 237 |
|
| 238 |
Mage::dispatchEvent('sales_convert_quote_item_to_order_item',
|
| 50 |
*/
|
| 51 |
->setIncrementId($quote->getReservedOrderId())
|
| 52 |
->setStoreId($quote->getStoreId())
|
| 53 |
+
->setQuoteId($quote->getId());
|
| 54 |
|
| 55 |
+
Mage::helper('core')->copyFieldset('sales_convert_quote', 'to_order', $quote, $order);
|
| 56 |
+
//
|
| 57 |
+
// ->setRemoteIp($quote->getRemoteIp())
|
| 58 |
+
//
|
| 59 |
+
// /**
|
| 60 |
+
// * Customer data
|
| 61 |
+
// */
|
| 62 |
+
// ->setCustomerId($quote->getCustomerId())
|
| 63 |
+
// ->setCustomerEmail($quote->getCustomerEmail())
|
| 64 |
+
// ->setCustomerPrefix($quote->getCustomerPrefix())
|
| 65 |
+
// ->setCustomerFirstname($quote->getCustomerFirstname())
|
| 66 |
+
// ->setCustomerMiddlename($quote->getCustomerMiddlename())
|
| 67 |
+
// ->setCustomerLastname($quote->getCustomerLastname())
|
| 68 |
+
// ->setCustomerSuffix($quote->getCustomerSuffix())
|
| 69 |
+
// ->setCustomerGroupId($quote->getCustomerGroupId())
|
| 70 |
+
// ->setCustomerTaxClassId($quote->getCustomerTaxClassId())
|
| 71 |
+
// ->setCustomerNote($quote->getCustomerNote())
|
| 72 |
+
// ->setCustomerNoteNotify($quote->getCustomerNoteNotify())
|
| 73 |
+
// ->setCustomerIsGuest($quote->getCustomerIsGuest())
|
| 74 |
+
// ->setCustomerDob($quote->getCustomerDob())
|
| 75 |
+
//
|
| 76 |
+
// /**
|
| 77 |
+
// * Currency data
|
| 78 |
+
// */
|
| 79 |
+
// ->setBaseCurrencyCode($quote->getBaseCurrencyCode())
|
| 80 |
+
// ->setStoreCurrencyCode($quote->getStoreCurrencyCode())
|
| 81 |
+
// ->setOrderCurrencyCode($quote->getQuoteCurrencyCode())
|
| 82 |
+
// ->setStoreToBaseRate($quote->getStoreToBaseRate())
|
| 83 |
+
// ->setStoreToOrderRate($quote->getStoreToQuoteRate())
|
| 84 |
+
//
|
| 85 |
+
// /**
|
| 86 |
+
// * Another data
|
| 87 |
+
// */
|
| 88 |
+
// ->setCouponCode($quote->getCouponCode())
|
| 89 |
+
// ->setGiftcertCode($quote->getGiftcertCode())
|
| 90 |
+
// ->setIsVirtual($quote->getIsVirtual())
|
| 91 |
+
// ->setIsMultiPayment($quote->getIsMultiPayment())
|
| 92 |
+
// ->setAppliedRuleIds($quote->getAppliedRuleIds());
|
| 93 |
|
| 94 |
|
| 95 |
Mage::dispatchEvent('sales_convert_quote_to_order', array('order'=>$order, 'quote'=>$quote));
|
| 108 |
$order = $this->toOrder($address->getQuote());
|
| 109 |
}
|
| 110 |
|
| 111 |
+
Mage::helper('core')->copyFieldset('sales_convert_quote_address', 'to_order', $address, $order);
|
| 112 |
+
|
| 113 |
+
// $order
|
| 114 |
+
// ->setWeight($address->getWeight())
|
| 115 |
+
// ->setShippingMethod($address->getShippingMethod())
|
| 116 |
+
// ->setShippingDescription($address->getShippingDescription())
|
| 117 |
+
// ->setShippingDetails($address->getShippingDetails()) // added by Sherrie Rohde for Pickup at Event / Multiple Flatrates extension
|
| 118 |
+
// ->setShippingRate($address->getShippingRate())
|
| 119 |
+
//
|
| 120 |
+
// ->setSubtotal($address->getSubtotal())
|
| 121 |
+
// ->setTaxAmount($address->getTaxAmount())
|
| 122 |
+
// ->setDiscountAmount($address->getDiscountAmount())
|
| 123 |
+
// ->setShippingAmount($address->getShippingAmount())
|
| 124 |
+
// ->setShippingTaxAmount($address->getShippingTaxAmount())
|
| 125 |
+
// ->setGiftcertAmount($address->getGiftcertAmount())
|
| 126 |
+
// ->setCustbalanceAmount($address->getCustbalanceAmount())
|
| 127 |
+
// ->setGrandTotal($address->getGrandTotal())
|
| 128 |
+
//
|
| 129 |
+
// ->setBaseSubtotal($address->getBaseSubtotal())
|
| 130 |
+
// ->setBaseTaxAmount($address->getBaseTaxAmount())
|
| 131 |
+
// ->setBaseDiscountAmount($address->getBaseDiscountAmount())
|
| 132 |
+
// ->setBaseShippingAmount($address->getBaseShippingAmount())
|
| 133 |
+
// ->setBaseShippingTaxAmount($address->getBaseShippingTaxAmount())
|
| 134 |
+
// ->setBaseGiftcertAmount($address->getBaseGiftcertAmount())
|
| 135 |
+
// ->setBaseCustbalanceAmount($address->getBaseCustbalanceAmount())
|
| 136 |
+
// ->setBaseGrandTotal($address->getBaseGrandTotal());
|
| 137 |
|
| 138 |
Mage::dispatchEvent('sales_convert_quote_address_to_order', array('address'=>$address, 'order'=>$order));
|
| 139 |
return $order;
|
| 151 |
->setStoreId($address->getStoreId())
|
| 152 |
->setAddressType($address->getAddressType())
|
| 153 |
->setCustomerId($address->getCustomerId())
|
| 154 |
+
->setCustomerAddressId($address->getCustomerAddressId());
|
| 155 |
+
|
| 156 |
+
Mage::helper('core')->copyFieldset('sales_convert_quote_address', 'to_order_address', $address, $orderAddress);
|
| 157 |
+
// ->setPrefix($address->getPrefix())
|
| 158 |
+
// ->setFirstname($address->getFirstname())
|
| 159 |
+
// ->setMiddlename($address->getMiddlename())
|
| 160 |
+
// ->setLastname($address->getLastname())
|
| 161 |
+
// ->setSuffix($address->getSuffix())
|
| 162 |
+
// ->setCompany($address->getCompany())
|
| 163 |
+
// ->setStreet($address->getStreet(-1))
|
| 164 |
+
// ->setCity($address->getCity())
|
| 165 |
+
// ->setRegion($address->getRegion())
|
| 166 |
+
// ->setRegionId($address->getRegionId())
|
| 167 |
+
// ->setPostcode($address->getPostcode())
|
| 168 |
+
// ->setCountryId($address->getCountryId())
|
| 169 |
+
// ->setTelephone($address->getTelephone())
|
| 170 |
+
// ->setFax($address->getFax());
|
| 171 |
+
|
| 172 |
+
Mage::dispatchEvent('sales_convert_quote_address_to_order_address',
|
| 173 |
+
array('address' => $address, 'order_address' => $orderAddress));
|
| 174 |
|
| 175 |
return $orderAddress;
|
| 176 |
}
|
| 185 |
{
|
| 186 |
$orderPayment = Mage::getModel('sales/order_payment')
|
| 187 |
->setStoreId($payment->getStoreId())
|
| 188 |
+
->setCustomerPaymentId($payment->getCustomerPaymentId());
|
| 189 |
+
Mage::helper('core')->copyFieldset('sales_convert_quote_payment', 'to_order_payment', $payment, $orderPayment);
|
| 190 |
+
// ->setMethod($payment->getMethod())
|
| 191 |
+
// ->setAdditionalData($payment->getAdditionalData())
|
| 192 |
+
// ->setPoNumber($payment->getPoNumber())
|
| 193 |
+
// ->setCcType($payment->getCcType())
|
| 194 |
+
// ->setCcNumberEnc($payment->getCcNumberEnc())
|
| 195 |
+
// ->setCcLast4($payment->getCcLast4())
|
| 196 |
+
// ->setCcOwner($payment->getCcOwner())
|
| 197 |
+
// ->setCcExpMonth($payment->getCcExpMonth())
|
| 198 |
+
// ->setCcExpYear($payment->getCcExpYear())
|
| 199 |
+
//
|
| 200 |
+
// ->setCcNumber($payment->getCcNumber()) // only for doing first transaction, not for save
|
| 201 |
+
// ->setCcCid($payment->getCcCid()) // only for doing first transaction, not for save
|
| 202 |
+
//
|
| 203 |
+
// ->setCcSsIssue($payment->getCcSsIssue()) //for direct payment
|
| 204 |
+
// ->setCcSsStartMonth($payment->getCcSsStartMonth()) //for direct payment
|
| 205 |
+
// ->setCcSsStartYear($payment->getCcSsStartYear()) //for direct payment
|
| 206 |
+
// ;
|
| 207 |
|
| 208 |
Mage::dispatchEvent('sales_convert_quote_payment_to_order_payment',
|
| 209 |
array('order_payment' => $orderPayment, 'quote_payment' => $payment));
|
| 222 |
$orderItem = Mage::getModel('sales/order_item')
|
| 223 |
->setStoreId($item->getStoreId())
|
| 224 |
->setQuoteItemId($item->getId())
|
| 225 |
+
->setQuoteParentItemId($item->getParentItemId())
|
| 226 |
->setProductId($item->getProductId())
|
| 227 |
+
->setProductType($item->getProductType())
|
| 228 |
+
->setProductOptions($item->getProduct()->getTypeInstance()->getOrderOptions());
|
| 229 |
+
|
| 230 |
+
Mage::helper('core')->copyFieldset('sales_convert_quote_item', 'to_order_item', $item, $orderItem);
|
| 231 |
+
|
| 232 |
+
if ($item->getParentItem()) {
|
| 233 |
+
$orderItem->setQtyOrdered($orderItem->getQtyOrdered()*$item->getParentItem()->getQty());
|
| 234 |
+
}
|
| 235 |
+
// ->setSku($item->getSku())
|
| 236 |
+
// ->setName($item->getName())
|
| 237 |
+
// ->setDescription($item->getDescription())
|
| 238 |
+
// ->setWeight($item->getWeight())
|
| 239 |
+
// ->setIsQtyDecimal($item->getIsQtyDecimal())
|
| 240 |
+
// ->setQtyOrdered($item->getQty())
|
| 241 |
+
// ->setOriginalPrice($item->getOriginalPrice())
|
| 242 |
+
// ->setAppliedRuleIds($item->getAppliedRuleIds())
|
| 243 |
+
// ->setAdditionalData($item->getAdditionalData())
|
| 244 |
+
//
|
| 245 |
+
// ->setPrice($item->getCalculationPrice())
|
| 246 |
+
// ->setTaxPercent($item->getTaxPercent())
|
| 247 |
+
// ->setTaxAmount($item->getTaxAmount())
|
| 248 |
+
// ->setRowWeight($item->getRowWeight())
|
| 249 |
+
// ->setRowTotal($item->getRowTotal())
|
| 250 |
+
//
|
| 251 |
+
// ->setBasePrice($item->getBaseCalculationPrice())
|
| 252 |
+
// ->setBaseOriginalPrice($item->getPrice())
|
| 253 |
+
// ->setBaseTaxAmount($item->getBaseTaxAmount())
|
| 254 |
+
// ->setBaseRowTotal($item->getBaseRowTotal());
|
| 255 |
|
| 256 |
if (!$item->getNoDiscount()) {
|
| 257 |
+
Mage::helper('core')->copyFieldset('sales_convert_quote_item', 'to_order_item_discount', $item, $orderItem);
|
| 258 |
+
// $orderItem->setDiscountPercent($item->getDiscountPercent())
|
| 259 |
+
// ->setDiscountAmount($item->getDiscountAmount())
|
| 260 |
+
// ->setBaseDiscountAmount($item->getBaseDiscountAmount());
|
| 261 |
}
|
| 262 |
|
| 263 |
Mage::dispatchEvent('sales_convert_quote_item_to_order_item',
|
app/code/community/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Shipping.php
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Mage
|
| 16 |
+
* @package Mage_Sales
|
| 17 |
+
* @copyright Copyright (c) 2004-2007 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class Mage_Sales_Model_Entity_Quote_Address_Attribute_Frontend_Shipping
|
| 23 |
+
extends Mage_Sales_Model_Entity_Quote_Address_Attribute_Frontend
|
| 24 |
+
{
|
| 25 |
+
public function fetchTotals(Mage_Sales_Model_Quote_Address $address)
|
| 26 |
+
{
|
| 27 |
+
$amount = $address->getShippingAmount();
|
| 28 |
+
if ($amount!=0) {
|
| 29 |
+
$address->addTotal(array(
|
| 30 |
+
'code'=>'shipping',
|
| 31 |
+
'title'=>Mage::helper('sales')->__('Shipping & Handling').' ',
|
| 32 |
+
'value'=>$address->getShippingAmount()
|
| 33 |
+
));
|
| 34 |
+
}
|
| 35 |
+
return $this;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
}
|
app/code/community/Mage/Sales/Model/Quote/Address/Total/Shipping.php
CHANGED
|
@@ -34,28 +34,88 @@ class Mage_Sales_Model_Quote_Address_Total_Shipping extends Mage_Sales_Model_Quo
|
|
| 34 |
}
|
| 35 |
|
| 36 |
$method = $address->getShippingMethod();
|
| 37 |
-
|
| 38 |
$freeAddress = $address->getFreeShipping();
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
foreach ($items as $item) {
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
-
if ($
|
| 45 |
-
$item->
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
}
|
| 55 |
}
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
}
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
$address->collectShippingRates();
|
| 60 |
|
| 61 |
$address->setShippingAmount(0);
|
|
@@ -69,7 +129,7 @@ class Mage_Sales_Model_Quote_Address_Total_Shipping extends Mage_Sales_Model_Quo
|
|
| 69 |
$address->setShippingAmount($amountPrice);
|
| 70 |
$address->setBaseShippingAmount($rate->getPrice());
|
| 71 |
$address->setShippingDescription($rate->getCarrierTitle().' - '.$rate->getMethodDescription());
|
| 72 |
-
$address->setShippingDetails($rate->getMethodDetails());
|
| 73 |
break;
|
| 74 |
}
|
| 75 |
}
|
|
@@ -86,7 +146,7 @@ class Mage_Sales_Model_Quote_Address_Total_Shipping extends Mage_Sales_Model_Quo
|
|
| 86 |
if ($amount!=0 || $address->getShippingDescription()) {
|
| 87 |
$address->addTotal(array(
|
| 88 |
'code'=>$this->getCode(),
|
| 89 |
-
'title'=>Mage::helper('sales')->__('Shipping & Handling'),
|
| 90 |
'value'=>$address->getShippingAmount()
|
| 91 |
));
|
| 92 |
}
|
| 34 |
}
|
| 35 |
|
| 36 |
$method = $address->getShippingMethod();
|
|
|
|
| 37 |
$freeAddress = $address->getFreeShipping();
|
| 38 |
|
| 39 |
+
$addressWeight = $address->getWeight();
|
| 40 |
+
$freeMethodWeight = $address->getFreeMethodWeight();
|
| 41 |
+
|
| 42 |
+
$addressQty = 0;
|
| 43 |
+
|
| 44 |
foreach ($items as $item) {
|
| 45 |
+
/**
|
| 46 |
+
* Children weight we calculate for parent
|
| 47 |
+
*/
|
| 48 |
+
if ($item->getParentItemId()) {
|
| 49 |
+
continue;
|
| 50 |
+
}
|
| 51 |
|
| 52 |
+
if ($item->getHasChildren() && $item->isShipSeparately()) {
|
| 53 |
+
foreach ($item->getChildren() as $child) {
|
| 54 |
+
$addressQty += $item->getQty()*$child->getQty();
|
| 55 |
+
if (!$item->getProduct()->getWeightType()) {
|
| 56 |
+
$itemWeight = $child->getWeight();
|
| 57 |
+
$itemQty = $item->getQty()*$child->getQty();
|
| 58 |
+
$rowWeight = $itemWeight*$itemQty;
|
| 59 |
+
$addressWeight += $rowWeight;
|
| 60 |
+
if ($freeAddress || $child->getFreeShipping()===true) {
|
| 61 |
+
$rowWeight = 0;
|
| 62 |
+
} elseif (is_numeric($child->getFreeShipping())) {
|
| 63 |
+
$freeQty = $child->getFreeShipping();
|
| 64 |
+
if ($itemQty>$freeQty) {
|
| 65 |
+
$rowWeight = $itemWeight*($itemQty-$freeQty);
|
| 66 |
+
}
|
| 67 |
+
else {
|
| 68 |
+
$rowWeight = 0;
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
$freeMethodWeight += $rowWeight;
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
if ($item->getProduct()->getWeightType()) {
|
| 75 |
+
$itemWeight = $item->getWeight();
|
| 76 |
+
$rowWeight = $itemWeight*$item->getQty();
|
| 77 |
+
$addressWeight+= $rowWeight;
|
| 78 |
+
if ($freeAddress || $item->getFreeShipping()===true) {
|
| 79 |
+
$rowWeight = 0;
|
| 80 |
+
} elseif (is_numeric($item->getFreeShipping())) {
|
| 81 |
+
$freeQty = $item->getFreeShipping();
|
| 82 |
+
if ($item->getQty()>$freeQty) {
|
| 83 |
+
$rowWeight = $itemWeight*($item->getQty()-$freeQty);
|
| 84 |
+
}
|
| 85 |
+
else {
|
| 86 |
+
$rowWeight = 0;
|
| 87 |
+
}
|
| 88 |
+
}
|
| 89 |
+
$freeMethodWeight+= $rowWeight;
|
| 90 |
}
|
| 91 |
}
|
| 92 |
+
else {
|
| 93 |
+
$addressQty += $item->getQty();
|
| 94 |
+
$itemWeight = $item->getWeight();
|
| 95 |
+
$rowWeight = $itemWeight*$item->getQty();
|
| 96 |
+
$addressWeight+= $rowWeight;
|
| 97 |
+
if ($freeAddress || $item->getFreeShipping()===true) {
|
| 98 |
+
$rowWeight = 0;
|
| 99 |
+
} elseif (is_numeric($item->getFreeShipping())) {
|
| 100 |
+
$freeQty = $item->getFreeShipping();
|
| 101 |
+
if ($item->getQty()>$freeQty) {
|
| 102 |
+
$rowWeight = $itemWeight*($item->getQty()-$freeQty);
|
| 103 |
+
}
|
| 104 |
+
else {
|
| 105 |
+
$rowWeight = 0;
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
$freeMethodWeight+= $rowWeight;
|
| 109 |
+
}
|
| 110 |
}
|
| 111 |
|
| 112 |
+
if (isset($addressQty)) {
|
| 113 |
+
$address->setItemQty($addressQty);
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
$address->setWeight($addressWeight);
|
| 117 |
+
$address->setFreeMethodWeight($freeMethodWeight);
|
| 118 |
+
|
| 119 |
$address->collectShippingRates();
|
| 120 |
|
| 121 |
$address->setShippingAmount(0);
|
| 129 |
$address->setShippingAmount($amountPrice);
|
| 130 |
$address->setBaseShippingAmount($rate->getPrice());
|
| 131 |
$address->setShippingDescription($rate->getCarrierTitle().' - '.$rate->getMethodDescription());
|
| 132 |
+
$address->setShippingDetails($rate->getMethodDetails()); // added by Sherrie Rohde for Pickup at Event / Multiple Flatrates extension
|
| 133 |
break;
|
| 134 |
}
|
| 135 |
}
|
| 146 |
if ($amount!=0 || $address->getShippingDescription()) {
|
| 147 |
$address->addTotal(array(
|
| 148 |
'code'=>$this->getCode(),
|
| 149 |
+
'title'=>Mage::helper('sales')->__('Shipping & Handling').' ', // edited by Sherrie Rohde for Pickup at Event / Multiple Flatrates extension
|
| 150 |
'value'=>$address->getShippingAmount()
|
| 151 |
));
|
| 152 |
}
|
app/design/frontend/default/minerva_default/template/checkout/cart/shipping.phtml
CHANGED
|
@@ -62,8 +62,17 @@
|
|
| 62 |
<?php echo $_rate->getErrorMessage() ?>
|
| 63 |
<?php else: ?>
|
| 64 |
<input name="estimate_method" type="radio" value="<?php echo $this->htmlEscape($_rate->getCode()) ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> />
|
| 65 |
-
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodDescription() ?>
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
<?php endif ?>
|
| 68 |
</li>
|
| 69 |
<?php endforeach; ?>
|
| 62 |
<?php echo $_rate->getErrorMessage() ?>
|
| 63 |
<?php else: ?>
|
| 64 |
<input name="estimate_method" type="radio" value="<?php echo $this->htmlEscape($_rate->getCode()) ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> />
|
| 65 |
+
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodDescription() ?>
|
| 66 |
+
-
|
| 67 |
+
<strong>
|
| 68 |
+
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
|
| 69 |
+
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
|
| 70 |
+
|
| 71 |
+
<?php echo $_excl; ?>
|
| 72 |
+
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
| 73 |
+
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
| 74 |
+
<?php endif; ?>
|
| 75 |
+
</strong></label><br/><div class="shipDetails"><?php echo $_rate->getMethodDetails() ?></div>
|
| 76 |
<?php endif ?>
|
| 77 |
</li>
|
| 78 |
<?php endforeach; ?>
|
app/design/frontend/default/minerva_default/template/checkout/onepage/shipping_method/available.phtml
CHANGED
|
@@ -32,7 +32,18 @@
|
|
| 32 |
<ul class="messages"><li class="error-msg"><ul><li><?php echo $_rate->getErrorMessage() ?></li></ul></li></ul>
|
| 33 |
<?php else: ?>
|
| 34 |
<input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> />
|
| 35 |
-
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodDescription() ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
<?php endif ?>
|
| 37 |
</li>
|
| 38 |
<?php endforeach; ?>
|
| 32 |
<ul class="messages"><li class="error-msg"><ul><li><?php echo $_rate->getErrorMessage() ?></li></ul></li></ul>
|
| 33 |
<?php else: ?>
|
| 34 |
<input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> />
|
| 35 |
+
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodDescription() ?>
|
| 36 |
+
-
|
| 37 |
+
<strong>
|
| 38 |
+
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
|
| 39 |
+
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
|
| 40 |
+
|
| 41 |
+
<?php echo $_excl; ?>
|
| 42 |
+
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
| 43 |
+
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
| 44 |
+
<?php endif; ?>
|
| 45 |
+
</strong>
|
| 46 |
+
</label><br /><div class="shipDetails"><?php echo $_rate->getMethodDetails() ?></div>
|
| 47 |
<?php endif ?>
|
| 48 |
</li>
|
| 49 |
<?php endforeach; ?>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Minerva_Shipping</name>
|
| 4 |
-
<version>0.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -42,12 +42,11 @@ The class shipDetails is built into these two template files. The standard css t
|
|
| 42 |
• Disable the display of the cost if price field is left blank.
|
| 43 |
• The ability to show/hide the # of options you wish to use.
|
| 44 |
• Set min/max purchase limits for each option.</description>
|
| 45 |
-
<notes>•
|
| 46 |
-
• No template files were changed in this release; there is no need to replace them if you are upgrading this extension.</notes>
|
| 47 |
<authors><author><name>Sherrie Rohde</name><user>auto-converted</user><email>sherrie.rohde@gmail.com</email></author><author><name>Robert Chambers</name><user>auto-converted</user><email>admin@robertchambers.co.uk</email></author></authors>
|
| 48 |
-
<date>2008-07-
|
| 49 |
-
<time>18:
|
| 50 |
-
<contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="minerva_default"><dir name="template"><dir name="checkout"><dir name="cart"><file name="shipping.phtml" hash="
|
| 51 |
<compatible/>
|
| 52 |
<dependencies/>
|
| 53 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Minerva_Shipping</name>
|
| 4 |
+
<version>0.9.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
| 42 |
• Disable the display of the cost if price field is left blank.
|
| 43 |
• The ability to show/hide the # of options you wish to use.
|
| 44 |
• Set min/max purchase limits for each option.</description>
|
| 45 |
+
<notes>• Made compatible with 1.1 Beta.</notes>
|
|
|
|
| 46 |
<authors><author><name>Sherrie Rohde</name><user>auto-converted</user><email>sherrie.rohde@gmail.com</email></author><author><name>Robert Chambers</name><user>auto-converted</user><email>admin@robertchambers.co.uk</email></author></authors>
|
| 47 |
+
<date>2008-07-21</date>
|
| 48 |
+
<time>21:18:45</time>
|
| 49 |
+
<contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="minerva_default"><dir name="template"><dir name="checkout"><dir name="cart"><file name="shipping.phtml" hash="9712afaf3d648deb1f6ea0d4ec5578da"/></dir><dir name="onepage"><dir name="shipping_method"><file name="available.phtml" hash="373e65a7e2cfb647b4c97906b78808de"/></dir></dir></dir></dir></dir><dir name="minerva_modern"><dir name="template"><dir name="checkout"><dir name="cart"><file name="shipping.phtml" hash="24224eeaeaaf30867d9870da1cea1175"/></dir><dir name="onepage"><dir name="shipping_method"><file name="available.phtml" hash="e780bf9f3bdee59b109213cb2c8de938"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Mage"><dir name="Sales"><dir name="Model"><dir name="Convert"><file name="Order.php" hash="df46dbf934e2834e8493a7097792b3f9"/><file name="Quote.php" hash="99c0080bf509824489e76717c2b1b281"/></dir><dir name="Entity"><dir name="Quote"><dir name="Address"><dir name="Attribute"><dir name="Frontend"><file name="Shipping.php" hash="57b7ad77bad9ec3152e7f7d923fcd473"/></dir></dir></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Shipping.php" hash="b234a6621c9d4e6a475d284bf6932c7e"/></dir><file name="Rate.php" hash="d5e2eba6ec52303c40813fcc2f450185"/></dir></dir></dir></dir></dir><dir name="Minerva"><dir name="Sales"><dir name="Model"><dir name="Quote"><dir name="Address"><file name="Rate.php" hash="215e24e55ce37c4f89de35bbddbd6aba"/></dir></dir></dir></dir><dir name="Shipping"><dir name="etc"><file name="config.xml" hash="a02565dacc1b6c91b7d2027cb6e931b7"/><file name="system.xml" hash="97bd8101ec042b07c8d8565e332c1f79"/></dir><dir name="Model"><dir name="Carrier"><file name="Multiflat.php" hash="7d994bce397d47714f04a206c4f6e637"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Minerva_Shipping.xml" hash="b2afec80b356c21a45f2e8590d86013a"/></dir></target></contents>
|
| 50 |
<compatible/>
|
| 51 |
<dependencies/>
|
| 52 |
</package>
|
