December 14, 2018

cm-mini

Thinking Magento

M2Epro Multi Channel Extension - Ebay Channel Url

You maybe using the M2Epro Multi Channel extension and realise that when you are viewing an order, there is no direct link to the order details on ebay. There is a link provided for Amazon orders.

To fix this issue so you can go straight from your Magento order to your ebay order requires the following change.

Open up Ess_M2ePro_Block_Adminhtml_Magento_Payment_Info

Add the following function

public function getChannelSalesRecord() {
    $order = Mage::getModel('M2ePro/ebay_order')->getCollection()
    ->addFieldToFilter('ebay_order_id', $this->getAdditionalData('channel_order_id'))
    ->getFirstItem();
    return $order->getSellingManagerId();
}

Find the following function getChannelOrderUrl()

Change it so that Buy and Play stop so the URL is blank.

case Ess_M2ePro_Helper_Component_Ebay::NICK:
if ($this->getOrder())
$itemId = substr( $this->getChannelOrderId(), 0, strrpos( $this->getChannelOrderId(), '-' ) );
$transId = substr( $this->getChannelOrderId(), strrpos( $this->getChannelOrderId(), '-' )+1 );

$url = "http://k2b-bulk.ebay.co.uk/ws/eBayISAPI.dll?EditSalesRecord&;transid=".$transId."&urlstack=".$this->getChannelSalesRecord()."|Period_Last122Days|currentpage_SCSold|&itemid=".$itemId;
}
break;

Then add the following code so that the URL for ebay is no longer blank

Save. Job complete.

You can either save this in the corresponding directory in local, or overwrite it in community, however any updates until this is fixed will be overwritten with each upgrade.

M2Epro Multi Channel Extension - How To Add Information To Sales_Order_Grid

If you're running M2EPro's Multi Channel Extension for ebay, play, amazon extension and you would like to add some of that information to your Sales_Order_Grid to save time navigating through the M2EPro menus and grids, the following information may prove to be useful for you.

In this instance we are going to add the ebay username to the Sale_Order_Grid so that we can perform lookups by ebay username

Copy from your core files Mage_Adminhtml_Block_Sales_Order_Grid into local 

Find function _prepareCollection()

Under $collection = Mage::getResourceModel($this->_getCollectionClass());

Addd the following code

$collection->getSelect()->joinLeft(array('m2eo'=>'m2epro_order'),'m2eo.magento_order_id=main_table.entity_id',array('m2eo.id')); 
$collection->getSelect()->joinLeft(array('m2eoi'=>'m2epro_order_item'),'m2eoi.order_id=m2eo.id',array('m2eoi.order_id')); 
$collection->getSelect()->joinLeft(array('m2eoe'=>'m2epro_ebay_order'),'m2eoe.order_id=m2eoi.order_id',array('m2eoe.buyer_user_id'));

What we are doing here is joinging 3 tables in the databse together. 

The first table we join is m2epro_order and match it up to the order_id of our magento orders. From m2epro_order the data we want to get is the id column.

Then we join m2epro_order_item but comparing the m2epro_order.id with m2epro_order_item.order_id. From m2epro_order_item the data we want to get is the order_id column.

Using the above 2 joins you now have access to the m2epro orders, which can perform look ups in ebay, amazon, play.

For this example we only require ebay usernames, but you could perform a CONCAT on amazon and ebay usernames together.

The final join is looking in m2epro_ebay_order joining m2epro_ebay_order.order_id to m2epro_order_item.order_id. This gives us the data we require to place the usernames on the grid.

Now adding your column to the grid, go down to function _prepareColumns()

$this->addColumn('buyer_user_id', array(
'header' => Mage::helper('sales')->__('User Id'),
'index' => 'buyer_user_id',
));

Save. Job complete


Changing Base URL and path of an installation (Moving to Production Server)

When you change the base URL of a Magento installation. You may think that this is a simple thing and forget to do some of the basics.

If you have changed the URL but now receive a weird error that your JS and CSS files are using the absolute path to those files, it will be because you have left on Merge CSS and Merge JS.

So.. What to do to get this right the first time

- In the admin turn off merge CSS and JS in the configuration
- Remove media/css and media/js directories (if exists)
- Check for fooman_speedster.xml in modules/etc and rename to fooman_speedster.disable
- In the admin check your Base URLs on default, website and store level. If you update the base URL, but it's set in the website or store level, it is not going to update.
- If you are locked out of your admin, update Core_Config_Data in the database for base urls (check website and store level)
- Delete var/cache
- Delete var/full_page_cache (Normally for Enterprise)

Magento - Prevent Tier / Special Priced Products Discounted By Sales Rules

So, we've all been here and we've all come to the same conclusion so far.

Within the sales rules you need to specify the products that have a special price should be ignored. This is all well and good until the sale item is no longer on sale and the special price still exists on the product.

Specifying Special From and To Dates, would be the obvious answer, however these dates are fixed, rather than being able to specify todays date.

So, we've updated the SalesRule_Validator to compare the price of the product in the cart, to the original product price.

This will work for products including tax and products excl tax rates.

Download the file and upload it to your server. No more fiddling with Sales Rules.

Download Here

As per usual, always test this on a backup server. This particular Validator.php file is from 1.7x

Magento Paypal Error - Rounding & Discount Issue

Error: Transaction refused because of an invalid argument. See additional error messages for details. The totals of the cart item amounts do not match order amounts.

This error seems to affect most tax inclusive installations and if you start seeing it in your payment_paypal_express.log then hopefully we will be able to supply you with a solution.

The problem lies with rounding, especially if you are using percentage based discounts, but also if prices end in 9,7,3.

To combat this we have attached a new NVP.php file for Magento 1.7x. You can look into the file and search for the Hack lines to import them over into your Magento installation.

Download File

Let us know if it improved your situation or if you think that you can improve on it further.

Original source of code: http://stackoverflow.com/questions/11868985/magento-paypal-tax-rounding-issue