I want to calculate shipping rate using UPS api in magento.
I will pass lenght, width, height and zipcode the UPS api will return shipping rate for that product.
I got the UPS rating API that will calculate the shipping rate from the below url after you login.
https://www.ups.com/upsdeveloperkit/downloadresource?loc=en_US
The development guide shows we can implement this using xml or SOAP call.
Can anyone tell me how exactly can I implement this in magento if
possible explain it at coding level.
You dont need to code your own api access. Just use the ootb UPS core extension.
Goto class Mage_Usa_Model_Shipping_Carrier_Ups
Goto line 907 (something like that) and change the part from
<Package>
<PackagingType><Code>{$params['48_container']}</Code></PackagingType>
<PackageWeight>
<UnitOfMeasurement><Code>{$r->getUnitMeasure()}</Code></UnitOfMeasurement>
<Weight>{$params['23_weight']}</Weight>
</PackageWeight>
</Package>
to
<Package>
<PackagingType><Code>{$params['48_container']}</Code></PackagingType>
<Dimensions>
<UnitOfMeasurement>
<Code>CM</Code>
</UnitOfMeasurement>
<Length>30</Length>
<Width>30</Width>
<Height>30</Height>
</Dimensions>
<PackageWeight>
<UnitOfMeasurement><Code>{$r->getUnitMeasure()}</Code></UnitOfMeasurement>
<Weight>{$params['23_weight']}</Weight>
</PackageWeight>
</Package>
Just use some variables to change 30 to whatever you want. It works, i tried it!
Good luck!
Related
HI I want to add some charges on cash on delivery, I dont know where to do that
what I need to extend or what observer I need to call and how I can get and update quote price can any body explain briefly to me.
Thanks in advance
Before you start thinking about code you need to describe (if only to yourself) how your new "cash on delivery" feature will work with Magento. When will users be prompted for this choice? What needs to be added to the backend order information panes? etc.
Once you know that, you can start to identify the blocks/phtml and model logic you'll need to change/add-to in order to implement your feature.
I am trying to set a filter that would calculate the cash-on-delivery payment when the customer selects a specific shipping zone (for out-of-town deliveries). I'm using the Table Rates Plug-in.
I was looking at this code (https://github.com/woothemes/woocommerce/issues/1499) at the answer by maxrice, but I can't adapt it to suit my needs:
My zone_id to exclude COD payment is table_rate-3.
As you can see looking at http://docs.woothemes.com/wc-apidocs/source-class-WC_Gateway_COD.html the native woocommerce COD class has no filters or actions you can hook into for your problem.
What you could do is disable the woocommerce native COD payment gateway and make your own. This link here provides a bit of a template for making your own payment gateway.
http://docs.woothemes.com/document/woocommerce-payment-gateway-plugin-base/
You could paste the woocommerce COD class in here (where it says // Go wild in here on line 31) and make changes as necessary. I imagine you'll mostly need to make changes to the is_available() function. You put that code down in either your themes functions.php file or better yet make your own plugin.
I've had a look at available Virtuemart plugins and I can't find anything close to what I am after. This is what I need.
Allow admin user to create coupon codes. An import feature would be nice as there will be thousands but I can handle this bit if needed anyway.
The admin user selects the number of products the customer is allowed for each coupon code.
When the customer uses the coupon code they are allowed to choose any product on the website up to the total amount of products issued to the coupon. Regardless of the products price.
Nice extra would be to allow free shipping with the coupon.
I've looked at the possibility of extending virtuemart and I think it would be possible. It would however require quite a lot of changes and if I can find something that is halfway there it would help me on my way.
Thanks in advance.
OK well time was running out and I didn't get an answer so I rolled my own. It was actually fairly painless. I can't release the code but I can give you a good idea of the steps and a direction to go in.
extend vm_ps_coupon and override the update, add and process methods. Add and update should only require a change to the array that is sent to the DB. See here for more info on extending classes
Alter the enum in the database to allow for quantity as well as total and percent.
Within your new update method handle the variation of quantity to do as you need.
In the update method you can also set a flag for free shipping in a session variable.
In templates/checkout edit list_shipping_methods.php. Simply check for the free shipping flag and load the free_shipping class. You can then call free_shipping->list_rates($vars);
extend vm_ps_checkout, override the add method, call the parent add method and then check the result so you can delete the session variable for the free shipping.
Finally you will need to make some changes in the HTML. Unfortunatly i could not find a way to override this easily and since its only two small changes to the markup i just went ahead and hacked the core. If anyone knows of another way that would be great? I did see something online about using a Joomla hook and a System plugin but I'd rather keep it reliant on Virtuemart only.
In administrator/components/com_virtuemart/html/ edit coupon.coupon_form.php to show the new quantity radio button.
Then edit coupon.coupon_list.php to display the correct values. Currently it will only display percent and total.
Hope this helps someone in the future. If you need some assistance then post on here and I'll be happy to help.
I wish to use the UK Initial CityLink courier, as the shipment provider. Does anyone know anything on integrating with their systems, such as an extension or plug-in?
If not, how can we add a new carrier to the list, so we can manually add a tracking number to the order. That the customer can use - to track their order on the CityLink website.
Add a new active/inactive carrier in config
<default>
<carriers>
<your_carrier>
<active>0|1</active>
<model>your_module/your_carrier</model>
<title>Your Carrier</title>
<name>your_carrier</name>
<price>0.00</price>
</your_carrier>
</carriers>
</default>
Then in your model your_module/your_carrier which extends Mage_Shipping_Model_Carrier_Abstract, rewrite the method isTrackingAvailable to return true:
public function isTrackingAvailable()
{
return true;
}
I hope you are in for a shock - most carriers work well to get your business and have backend systems that work well. CityLink are in the era of having bespoke Visual Basic applications running on a 486 PC with a dot-matrix printer. I exaggerate but you get the idea.
We wrote our own CityLink module to work on their zone rates taking volumetric measurements into account and checking that we did not exceed the maximum dimensions.
This requires the rates to be manually entered and does not print labels or anything fancy - the customer gets an accurate quote though.
I think they have tidied up their rates to being sensible enough to use the standard table rates of Magento, you can also enter in the tracking number at delivery time when you 'create delivery'.
Your best bet would be installing Parcelhub software to integrate multiple carriers into your Magento account.
if you are going to modify function getCarriers() as suggested by Rashid, note that this function is repeated in several places:
\app\code\core\Mage\Adminhtml\Block\Sales\Order\Invoice\Create\Tracking.php
\app\code\core\Mage\Adminhtml\Block\Sales\Order\Shipment\Create\Tracking.php
\app\code\core\Mage\Adminhtml\Block\Sales\Order\Shipment\View\Tracking.php
\app\code\core\Mage\Sales\Model\Order\Shipment\Api.php
To add new carrier in the listSimply edit the tracking.php file from directory
app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/
find the code
public function getCarriers()
{
$carriers = array();
$carrierInstances = Mage::getSingleton('shipping/config')->getAllCarriers(
$this->getShipment()->getStoreId()
);
$carriers['custom'] = Mage::helper('sales')->__('CustomValue');
and then make copy of the last line i.e
$carriers['custom'] = Mage::helper('sales')->__('CustomValue');
Now chage 'custom' with your 'customvalue' and 'CustomValue' with your own Custom Label e.g
$carriers['firstflight'] = Mage::helper('sales')->__('First Flight Courier');
Hope it will help you!!
I am attempting to integrate an afilliate network with my Magento shopping cart. I am using Google Checkout so i need to modify app/code/core/mage/googlecheckout/model/api/xml/checkout.xml in order to pass some tracking info to Google Checkout.
So far I have this code:
<merchant-checkout-flow-support>
<parameterized-urls>
<parameterized-url url="https://track.webgains.com/transaction.html?wgver=1.1&wgprogramid=4449&wgrs=1&wgeventid=7041&wgvouchercode=XXXXX"/>
<parameters>
<url-parameter name="wgorderreference" type="order-id"/>
<url-parameter name="wgvalue" type="order-total"/>
</parameters>
</parameterized-urls>
....
</merchant-checkout-flow-support>
Does anyone know how I can replace the 'XXXXX' with the name of any discount code which has been used?
Thanks!
I'm guessing here, but have you tried adding a new attribute to the Order object called (say) order-voucher-code (this forum thread gives you that process), and then inserting:
<url-parameter name="wgvouchercode" type="order-voucher-code"/>
That might work?