#StackBounty: #magento-1.9 #fedex #address #ups How to Add Multiple Pickup Address

Bounty: 50

I have two stores, one from San San Antonio and another one Detroit. I will get the details from the customer,

enter image description here

I am using FedEx and UPS,

Supposed user select San Antonio, San Antonio based shipping charges display to the customer (This my current process) if customer select Detroit, Detroit based shipping charges display to the customer(Need to configure).

My one of the store running in San Antonio, so shipping charge display to the customer.

My another store will be open on next month in Detroit, so how can display shipping charge based on Detroit, because my pickup point Detroit(By Default my store display San Antonio based pickup charge to customer )

How can I add two pickup address charges method to the customer, if customer select San Antonio, display San Antonio based shipping charge (current process working fine), also how can I display Detroit pickup shipping charges to the customer?

enter image description here

How can I configure more than one pick up address?


Get this bounty!!!

#StackBounty: #magento-1.9 #checkout #shopping-cart-price-rules #coupon-codes Discount from Specific Shipping Method based on coupon co…

Bounty: 50

I need in admin section to apply coupon only on particular shipping method not discount from other shipping method. I should be able to select shipping method in admin which I want to allow for discount.

In frontend whenever customer apply that coupon, the amount should not deducted from the subtotal/ grand total, Only the particular shipping method(Which we had allowed in admin section) should be pre-selected and shown with discount applied.

Please find the sample screenshot in attachment. This is what I want to achieve.

Frontend Checkout page

Coupon Code

Admin Section


Get this bounty!!!

#StackBounty: #magento-1.9 #shipping #shipping-methods #quote #shipping-address Creating Quote Address the right way

Bounty: 50

I’m trying to create a quote address programmatically, everything is working fine and the order is created, however this is after 2 workarounds im not sure why i need them, I’ll list all the observations I have and hopefully someone can point out what im doing wrong.

My biggest problems is calculating the shipping cost, and the way a shipping address is created, so let’s say the basic way to create a quote order is as follows (don’t mind the variables) :

// Initializing the Quote Model, all good here
$quote = Mage::getModel('sales/quote')
    ->setStoreId($store_id)
    ->setWebsiteId($website_id)
    ->assignCustomer($customer);

// The shipping address, all good here
$shipping_address = array(
    'prefix' => '',
    'firstname' => $customer->getFirstname(),
    'middlename' => '',
    'lastname' => $customer->getLastname(),
    'suffix' => '',
    'company' => '',
    'street' => array(
        '0' => $d['street'],
        '1' => ''
    ),
    'city' => $d['city'],
    'country_id' => $d['country_id'],
    'region' => $d['region'],
    'postcode' => '0000',
    'telephone' => $customer->getPhone(),
    'fax' => '',
    'vat_id' => '',
    'save_in_address_book' => 1
);

// Adding a product, all good here
$quote->addProduct($product_model, new Varien_Object(
    array(  'qty' => 1,
            'options' => $options
        )
));

// Setting the shipping/billing address
$quote->getShippingAddress()->addData($shipping_address);
$quote->getBillingAddress()->addData($shipping_address);

// Setting the shipping method, all good here as well
$methods = Mage::getSingleton('shipping/config')->getActiveCarriers();
foreach($methods as $_code => $_method){
    // Get the first allowed method of this shipping carrier
    $m = key($_method->getAllowedMethods());
    $shipping_method = $_code . '_' . $m;
}
$shippingAddress->setShippingMethod($shipping_method);

// Collecting the shipping rates, i have no clue what im doing wrong here
$shippingAddress->setWeight(90); // I will have to set his manually, not sure why
$shippingAddress->setFreeMethodWeight(90); // I will have to set this manually, not sure why
$shippingAddress->setShippingMethod($shipping_method);
$shippingAddress->setCollectShippingRates(true);
$shippingAddress->collectShippingRates();

$quote->collectTotals();

Now I want to retrieve the shipping cost, so I just do a $quote->getShippingAddress()->getShippingAmount().

The problem is I have to set the shipping weight as follow for this to work, as in the code block above:

$shippingAddress->setWeight(90);
$shippingAddress->setFreeMethodWeight(90);

This is because for some reason, in

app/code/core/Mage/Sales/Model/Quote/Address.php:913

$request->setPackageWeight($item ? $item->getRowWeight() : $this->getWeight());

The getWeight function returns 0, if i didn’t set it explicilty, and it makes sense, since in my code i don’t find anywhere it’s calculated or modified when im adding the products to fetch the weight from. So this is my first issue, why im setting the weight explicitly, why i need to do so.

The second issue is the $shippingAddress->setFreeMethodWeight(90); line, i have to do this as well, because in

app/code/Mage/Shipping/Model/Carrier/Tablerate.php:138

// Package weight and qty free shipping
$oldWeight = $request->getPackageWeight();
$oldQty = $request->getPackageQty();

$request->setPackageWeight($request->getFreeMethodWeight());
$request->setPackageQty($oldQty - $freeQty);

$result = $this->_getModel('shipping/rate_result');
$rate = $this->getRate($request);

$request->setPackageWeight($oldWeight);
$request->setPackageQty($oldQty);

The getRate function is calculated after setting the package weight to the return value of getFreeMethodWeight, which is null if I didn’t set it as above. I have the FreeShipping shipping method disabled, and no Cart Price rules, so I have no idea why the above lines are written this way.

That’s pretty much it. Hopefull I was able to explain everything.


Get this bounty!!!

#StackBounty: #magento-1.9 #shipping #tax #quote #create-order Creating Order and Collecting Totals

Bounty: 50

I’m having a very hard time collecting the right totals when creating an order by code (magento 1.9, php5.4). I’m creating a quote as you noramlly would, added products and shipping/billing address, and now I’m collection the subtotal/shipping/taxes/grandtotal, and im not getting the right calculations.

For the example below, I have the following:

Product Price is 100
Taxes on Product Price is 25
Shipping Amount is 10
Shipping Taxes is 2.5
Grand total should be 137.5

When when executing $quote->collectTotals(); to get the order grand total, im always getting 110 for $quote->getGrandTotal() or $quote->getShippingAddress()->getGrandTotal(). I should be getting 137.5.

So I google around and did my homework, and apparently there was a problem in the order of the collection, so magento was collecting using the following order:

tax_shipping
nominal
subtotal
freeshipping
tax_subtotal
weee 
shipping 
discount 
grand_total
msrp 
tax 

and the following total amounts were calculated:

enter image description here

So it looked like grand_total was calculated before adding the tax, and this is why I was getting 110 instead of 137.5, which makes sense, since all what the grand total class does is to sum up the total:

class Mage_Sales_Model_Quote_Address_Total_Grand extends Mage_Sales_Model_Quote_Address_Total_Abstract
{
    /**
     * Collect grand total address amount
     *
     * @param   Mage_Sales_Model_Quote_Address $address
     * @return  Mage_Sales_Model_Quote_Address_Total_Grand
     */
    public function collect(Mage_Sales_Model_Quote_Address $address)
    {
        $grandTotal     = $address->getGrandTotal();
        $baseGrandTotal = $address->getBaseGrandTotal();

        $store      = $address->getQuote()->getStore();
        $totals     = array_sum($address->getAllTotalAmounts());
        $totals     = $store->roundPrice($totals);
        $baseTotals = array_sum($address->getAllBaseTotalAmounts());
        $baseTotals = $store->roundPrice($baseTotals);

        $address->setGrandTotal($grandTotal+$totals);
        $address->setBaseGrandTotal($baseGrandTotal+$baseTotals);
        return $this;
    }

So I though if I changed the order of the collection, by moving the grand_total collection after the tax collection, this would solve my problem, so used i overrode the order using this simple extension https://github.com/hartmut-co-uk/magento-php7-totals-fix, after all it looked like a lot of people are facing the same issue with PHP7 and PHP5.5, although im using PHP5.4, i thought i would give it a shot, considering how desperate i am.

Now things are a bit different, the collection total changed to:

nominal
freeshipping
tax_subtotal
msrp
subtotal
weee
shipping
tax_shipping
discount
tax
grand_total

So I though all my problem went away, but for some reason, now the tax are not calculated the right way, I’m getting 2.5 for the tax instead of 27.5

enter image description here

I know the post is super long and can be hard to follow, but hopefully I was able to explain the problem. So the first question is:

  1. Why grand_total collector is not called in the right order in the first place.
  2. I have no idea what to do next. Suggestions are strongly welcomed :D.


Get this bounty!!!

#StackBounty: #magento-1.9 #product #sku #taxes How Can I Apply TAX Rule Based On Individual SKU Wise – Taxable Goods

Bounty: 50

I need to apply the tax rate for my all products with the unique tax rate, Tax rate different from each other, I mean all products have the own tax rate. How can I solve it?


Get this bounty!!!

#StackBounty: #magento-1.9 #orders #custom-options #csv How Can I Create Custom Order Using CSV with multiple Products along with Custo…

Bounty: 50

Many times I did the manual order for the customer, some order consists 100’s of products, how can I create custom order by using CSV? Is possible import order by CSV? or is possible to import order by programmatically?


Get this bounty!!!

#StackBounty: #magento-1.9 #api #custom-options #table How do i get to Magento Table value using API

Bounty: 50

I am using the WebShopApps MatrixRate – #1 Multiple Table Rates Extension for User Selection of courier service. I need to get this table Values by API. how do I get to Magento table value using API? Actually, I need this values for my DotNet Platform.

Extension Url : https://goo.gl/Lj3P3u


Get this bounty!!!

#StackBounty: #magento-1.9 #category #payment-methods #shopping-cart-price-rules How to give condition selected sku paid only selected …

Bounty: 100

When user add those skus [ items] to add to cart than I want to allow only some particular payment methods.


Get this bounty!!!

#StackBounty: #magento-1.9 If pre-order(Customized) products need to purchase, not allowed non-pre-order products include into the chec…

Bounty: 100

How can i set the condition, if pre-order(Customized) products purchase, not other products include into the checkout, how can i add the condition

How can I give condition like, if some of the non-pre-order products
in the cart not able to allow my pre-order products and another one if
my cart consists Pre-order products not allowed non-pre-orders
products? How can I do that?


Get this bounty!!!

#StackBounty: #magento-1.9 Update dropdown attribute value Programtically for single product

Bounty: 100

Onclick Add to cart button we are trying to update the Attribute value from “NO” to “YES”.

[ attribute code : cart_status (Yes/No dropdown) Attribute ]

I tried below code, its changing attribute values for all products, but i need to change value only for that particular product that i added to cart.

<?php

foreach ($collections as $key => $product) 
{
    echo $product->getName().' <br><br>';           
    $_product = Mage::getModel('catalog/product')->load($product->getId());             
?>

<form action="<?php 

echo  Mage::helper('checkout/cart')->getAddUrl($product);

// update cart_status

    echo "n".'updating '.$_product->getSku()."...n";
    $_product->setData('cart_status', 1)->getResource()->saveAttribute($_product, 'cart_status');
    $_product->save(); 

// update cart_status end

?>" method="post">  
</form>


Get this bounty!!!