Categories
Hosting Magento

Best Magento Hosting Company

When choosing the best Magento Hosting or Magento 2 hosting to host a small/medium sized Magento store, I always try to find out which company offers customers the most value. In my opinion, there are 4 things that make up a best Magento hosting.

  • Hosting performance, including Load speed, uptime, and capability to handle concurrent requests.
  • Magento specialized tool
  • Support: Knowledge, speed, and reliability of support on hosting problems and common Magento problem
  • Pricing: Price/value, Cheap and Affordable Magento with decent power.

SiteGround

Features 1-Click Install Magento
*Free Backup tool
Magento Optimized
24/24 support
Livechat + Ticket for common Magento issues
FREE SuperCaching + CDNFree Magento theme
Price – $3.95/month

Categories
Magento

Magento Ebay Feeds

I have created a custom magento code (Magento Ebay Feeds) which can export magento products to csv and that csv can be easily imported to eBay.  My extension allows to import products, pricing, description, images and more data from your “Magento Store” to your eBay. The Extension can export simple and configurable products transforms them into eBay compatible csv format. Imported products start showing on your eBay store instantly. You need to simply import that csv to your eBay store.

This extension is similar to
Ebay2Magento – http://magegaga.com/ebay2magento.html
eBay Integration    –    https://www.magentocommerce.com/magento-connect/ebay-integration.html

Please let me know if you are looking for Amazon Integration for Magento like –    https://www.mag-manager.com/magento-amazon-integration/

Categories
Magento PHP Security

Magento : How to apply SUPEE-5344 and SUPEE-1533 from the Magento Community Edition

Urgent: Immediately install Magento critical security patches.

It is critical for you to download and install 2 previously-released security patches (SUPEE-5344 and SUPEE-1533) from the Magento Community Edition download page (https://www.magentocommerce.com/products/downloads/magento/).

1. Go to https://www.magentocommerce.com/products/downloads/magento/ and download the right version of patches.

2. Upload your files into Magento root directory. It is important to place patch files directly into Magento root directory and execute it also directly in Magento root directory.

3. Run the patches like this
# bash ./PATCH_SUPEE-1533_EE_1.12.x_v1-2015-02-10-08-19-16.sh
Checking if patch can be applied/reverted successfully…
Patch was applied/reverted successfully.

# bash ./PATCH_SUPEE-5345_CE_1.7.0.2_v1-2015-02-10-08-11-22.sh
Checking if patch can be applied/reverted successfully…
Patch was applied/reverted successfully.

4. Verify if the patch is added successfully
Test that your store is working fine. Login to admin and clear all the cache from cache management and flush other PHP opcode caches(APC/XCache/eAccelerator) if you are using, otherwise code will continue to run from caches.

Verify that your store have green SAFE status at https://shoplift.byte.nl

Please read below if you get errors while running the above bash command.

Note – While running the bash commands mentioned in step 3, if you get errors like below-:
Error! Some required system tools, that are utilized in this sh script, are not installed:
Tool(s) “patch” is(are) missed, please install it(them).
Then you need to first install patch like this

# yum install patch

4. Once you install the patch then follow the step 3.

Source

If you are using a shared hosting or don’t have ssh access to install the security patches then please follow this link – How to apply SUPEE-5344 and SUPEE-1533 without SSH

Categories
Magento PHP

Magento : How to Convert Price from Current Currency to Base Currency

If in some case you want to convert the price to base corrency in Magento then there is a very simple function available ‘currencyConvert()’ but this function is NOT WORKING in magento community 1.7 version.

<?php
$from 		= 'USD';
$to 		= 'NPR';
$price 		= 10;
$newPrice 	= Mage::helper('directory')->currencyConvert($price, $from, $to);
?>

Source

magento convert price in base currency
I tried another way to solve this. You can use the below working code to get the price in base currency.

<?php
//	Convert price to base currency from current currency
$totals 	= 	Mage::getSingleton('checkout/cart')->getQuote()->getTotals();
$subtotal 	= 	$totals["subtotal"]->getValue();
// Base Currency
$baseCurrencyCode 		= 	Mage::app()->getStore()->getBaseCurrencyCode();
// Current Currency
$currentCurrencyCode 	= 	Mage::app()->getStore()->getCurrentCurrencyCode();
if( $baseCurrencyCode != $currentCurrencyCode ){
	// Allowed currencies
	$allowedCurrencies 	= 	Mage::getModel('directory/currency')->getConfigAllowCurrencies();
	$rates 				= 	Mage::getModel('directory/currency')->getCurrencyRates($baseCurrencyCode, array_values($allowedCurrencies));
	$convertedSubtotal	=	$subtotal / $rates[$currentCurrencyCode];	
}else{
	$convertedSubtotal	=	$subtotal;
}
?>

Source

Categories
Magento

Magento : How to get Product Reviews posted during a time period

Customer reviews for your products and services always play a vital role in the success of your business. As magento have inbuilt functionality of reviews for products and when a customer write a review for product then the approved reviews will show on the product pages. If you are using service of Google Merchant Review Feeds then you need to submit the reviews posted between a specific dates. The following code snippet will be useful for you to get the magento product reviews.

How Magento Reviews are useful for growth of your business

<?php		// Added by Vaseem to get the product reviews posted during a time period
$fromDate	=	'2014-04-01 00:00:00';
$toDate		=	'2014-04-01 23:59:59';
$_reviews 	= 	Mage::getModel('review/review')
                ->getCollection()
                ->addStoreFilter(Mage::app()->getStore()->getId())
                ->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
                ->addFieldToFilter('created_at', array('from'=>$fromDate, 'to'=>$toDate))
                ->setDateOrder()
                ->load();
foreach($_reviews as $review){
    $product 			= 	Mage::getModel('catalog/product')->load($review->getData('entity_pk_value'));
    $review_id			=	$review->getData('review_id');
    $created_at			=	$review->getData('created_at');
    $entity_id			=	$review->getData('entity_id');
    $entity_pk_value	=	$review->getData('entity_pk_value');
    $status_id			=	$review->getData('status_id');
    $detail_id			=	$review->getData('detail_id');
    $title				=	$review->getData('title');
    $detail				=	$review->getData('detail');
    $nickname			=	$review->getData('nickname');
    $customer_id		=	$review->getData('customer_id');
}
?>

I hope the above code will be useful for you 🙂

Categories
Magento PHP

Magento : How to Update Product Price In Cart Programmatically

If you want to Add Product to Magento Cart with Price Change then you have to write an Observer that listens the “checkout_cart_product_add_after” or “checkout_cart_update_items_after” event.
You need to modify the code as shown below.

The code is same except checkout_cart_product_add_after is called for only one item and checkout_cart_update_items_after is called for all items in the cart.

Step 1. Open etc/config.xml of your module. CodeMasterz is company name and CustomDiscount is your module name

<?xml version="1.0"?>
<config>
    <modules>
       ...
    </modules>
    <global>
        <models>
           ...
        </models>
		
		<!--Creating a observer for custom discount on cart page by Vaseem-->
		<events>
            <checkout_cart_product_add_after>
                <observers>
                    <unique_event_name>
                        <class>CodeMasterz_CustomDiscount_Model_Observer</class>
                        <method>myCustomDiscount</method>
                    </unique_event_name>
                </observers>
            </checkout_cart_product_add_after>
        </events>
		
        ...
    </global>
</config>

Step 2. Then create a file in your module folder “Model/Observer.php”

<?php
class CodeMasterz_CustomDiscount_Model_Observer
{
    
    public function myCustomDiscount(Varien_Event_Observer $observer)
    {
        $item = $observer->getQuoteItem();
        if ($item->getParentItem()) {
            $item = $item->getParentItem();
        }
        //discount 20% off
        $discount = 0.20; 
        // Check if the discount isn't applied over and over while refreshing
        //$specialPrice = $item->getPrice() - ($item->getPrice() * $discount);
		$specialPrice	=	125;
		
        if ($specialPrice > 0) {
            $item->setCustomPrice($specialPrice);
            $item->setOriginalCustomPrice($specialPrice);
            $item->getProduct()->setIsSuperMode(true);
        }
    }
?>

Hope above works for you. If you have any difficulty understanding the code or anything else then you can contact me using contact page at this website.

Categories
Magento PHP

Magento : How to Redirect Non Logged in Users to Login Page

There are some many ways to redirect users/visitors in magento. But the most easy way i found is written below.
To redirect the users/visitors to login page you can add below line of code in head.phtml of your current theme.

<?php		// Added by Vaseem to redirect non logged in user to login page
$currentUrl = $this->helper('core/url')->getCurrentUrl();
echo 'currentUrl->'.$currentUrl.'<br>';
$loginStatus	=	'';
if ( strpos( $currentUrl, "customer" ) !== false ) {
	$loginStatus	=	1;
}
if(!$this->helper('customer')->isLoggedIn() && $loginStatus!=1){
	echo 'redirect to login page now';
  	Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('customer/account/login/'));
}
?>