Add Guest Order to a Customer Account in Magento

To get the customer_id simply go to Customers > Manage Customers in the Magento admin.

Log in to the MySQL and execute the following queries:

UPDATE sales_flat_order 
 SET customer_id = (YOUR-CUSTOMER-ID), customer_is_guest=0 
 WHERE entity_id = YOUR-ORDER-ID AND customer_id IS NULL
 
UPDATE sales_flat_order_grid 
 SET customer_id = YOUR-CUSTOMER-ID
 WHERE entity_id = YOUR-ORDER-ID AND customer_id IS NULL
 

Magento: Removing Billing Agreements, Recurring Profiles & My Applications links

Magento: Removing Billing Agreements, Recurring Profiles & My Applications links from customer account.

 

Step 1: Go to ( yourPackage/YourTemplate/customer/account/navigation.phtml )

Step 2: Replace the below line

<?php $count = count($links); ?>

**With**

<?php $_count = count($_links); /* Add or Remove Account Left Navigation Links Here -*/
unset($_links['account']); /* Account Info */
unset($_links['account_edit']); /* Account Info */
unset($_links['tags']); /* My Tags */
unset($_links['reviews']);  /* Reviews */
unset($_links['wishlist']); /* Wishlist */
unset($_links['newsletter']); /* Newsletter */
unset($_links['orders']); /* My Orders */
unset($_links['address_book']); /* Address */
unset($_links['OAuth Customer Tokens']); /* My Applications */
unset($_links['downloadable_products']); /* My Downloadable Products */
unset($_links['recurring_profiles']); /* Recurring Profiles */
unset($_links['billing_agreements']); /* Billing Agreements */

?>

Available qyt on the cart page in Magento 1

For the available qyt on the cart page use below code;


	   	<!-- start available qty to product in app\design\frontend\ultimo\colorfabb\template\checkout\cart\item\default.phtml-->
        < ?php

		$productId = $_item->getProductId();
		$product = Mage::getModel('catalog/product')->load($productId);
		if($product->getTypeId() == "configurable"){
			$sku = $_item->getSku();
			$simpProdId = Mage::getModel('catalog/product')->loadByAttribute('sku',$sku)->getId();
			$product = Mage::getModel('catalog/product')->load($simpProdId);
		}

		$quantity = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
		?>
		<span style="font-weight: bold;color:#ff0000;">Available qty:< ?php echo (int) $quantity;?></span>
		
		<!-- einde available qty to product -->

Upgrade Magento 1 Via SSH

Upgrading Magento via SSH is usually much simpler than via the magento downloader. To upgrade follow these simple steps.

1. First backup. Download a copy of your database, and backup your files. You can make a zip of them.

2. Set the permissions for mage:
chmod +x mage

3. Run mage-setup and sync:
./mage mage-setup .
./mage sync

4. Upgrade Magento:
./mage upgrade-all --force

If that doesn’t work, try:
./mage install http://connect20.magentocommerce.com/community Mage_All_Latest --force

5. It’s always a good idea to run the indexer and clear the cache:
php shell/indexer.php reindexall
rm -rf downloader/.cache/ var/cache/

You’re all done (as long as there were no errors.

 

Error:

/mage mage-setup .

I receive:

Running initial setup…

Success

Success

Error:

channel-add: Channel ‘community’ already exist!

Do:

in the magento directory :

./mage channel-delete community

./mage mage-setup

Then add the extension again via magento connect

and

Go to “downloader” folder and delete the file “cache.cfg”. Then go back to Magento Connect and retry

Magento orders by sku

SQL code for orders by sku

SQL code for orders by sku


SELECT sales_flat_order.increment_id,
 sales_flat_order_item.order_id,
 sales_flat_order_item.sku,
 sales_flat_order.status,
 sales_flat_order_item.name,
 sales_flat_order.customer_email
 FROM dbname.sales_flat_order_item sales_flat_order_item
 INNER JOIN dbname.sales_flat_order sales_flat_order
 ON (sales_flat_order_item.order_id = sales_flat_order.entity_id)
 WHERE (sales_flat_order_item.sku = 'fill in sku no ')
 AND (sales_flat_order.status &lt;&gt; 'Canceled')
ORDER BY sales_flat_order.increment_id DESC


Disable paypal logo from sidebar in Magento

System > Configuration > Payment Methods

> Paypal All in One Payments Solutions
> Paypal Payments Advanced (Includes Express Checkout)
> Basic Settings – Paypal Payments Advanced
> Frontend Expereince settings
> Paypal Product Logo

MySQL query caching for ex. Magento

Login Plesk MySQL

On server with Parallels Plesk Panel versions 8.x, 9.x and above admin password is stored in file /etc/psa/.psa.shadow. Use the following command to get the password:

~# cat /etc/psa/.psa.shadow

Since version 10 admin password stored in file /etc/psa/.psa.shadow is encrypted. Use the following command to get admin password in plain text:

~# /usr/local/psa/bin/admin --show-password

Despite version of Parallels Plesk Panel you may use the following command to login to mysql with root privileges:

~# mysql -uadmin -p`cat /etc/psa/.psa.shadow`

MySQL query caching

Login with:

mysql -u username -p
SHOW VARIABLES LIKE 'have_query_cache';

mysql> SHOW VARIABLES LIKE 'have_query_cache';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| have_query_cache | YES   |
+------------------+-------+
1 row in set (0.00 sec)
SHOW VARIABLES LIKE 'query_cache_size';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| query_cache_size | 0     |
+------------------+-------+
1 row in set (0.00 sec)
SHOW VARIABLES LIKE 'query%';
+------------------------------+---------+
| Variable_name                | Value   |
+------------------------------+---------+
| query_alloc_block_size       | 8192    |
| query_cache_limit            | 1048576 |
| query_cache_min_res_unit     | 4096    |
| query_cache_size             | 0       |
| query_cache_type             | ON      |
| query_cache_wlock_invalidate | OFF     |
| query_prealloc_size          | 8192    |
+------------------------------+---------+
7 rows in set (0.01 sec)

Hieronder zie je wat de meest belangrijke onderdelen betekenen in de bovenstaande lijst:

query_cache_size : Dit is de grootte van de cache in bytes. Wanneer je de waarde van deze instelling op het getal 0 zet zul je effectief caching uitzetten. query_cache_type : Deze waarde moet ingesteld staan op ON of het getal 0 om query caching standaard aan te hebben staan. query_cache_limit – Dit is de maximale query grootte (wederom in bytes) dat gecached zal worden.

Wanneer de instelling query_cache_size op 0 staat, of je deze zelf wilt aanpassen zul je onderstaande query uit moeten voeren. Hou er rekening mee dat de waarde in bytes is! Bijvoorbeeld: wanneer je 16 megabyte wil toewijzen aan de cache zul je deze moeten berekenen met : 1024 x 1024 x 16 = 16777216. Stel dan 16777216 in als de waarde voor de instelling query_cache_size. SET GLOBAL query_cache_size = 16777216;

SET GLOBAL query_cache_size = 16777216;

De overige instellingen zijn op een soortgelijke manier in te stellen: SET GLOBAL query_cache_type = 1; SET GLOBAL query_cache_limit = 1048476;

SET GLOBAL query_cache_type = 1;
SET GLOBAL query_cache_limit = 1048476;

Hoe kun je er zeker van zijn dat je instellingen werken? Simpel, je kunt hier de query SHOW STATUS voor gebruiken om alle variabelen te laten tonen die beginnen met “Qc”. Laten we een kijkje nemen: ======

SET GLOBAL query_cache_size = 16777216;
SHOW STATUS LIKE 'Qc%';
+-------------------------+----------+
| Variable_name           | Value    |
+-------------------------+----------+
| Qcache_free_blocks      | 1        |
| Qcache_free_memory      | 16759696 |
| Qcache_hits             | 0        |
| Qcache_inserts          | 0        |
| Qcache_lowmem_prunes    | 0        |
| Qcache_not_cached       | 0        |
| Qcache_queries_in_cache | 0        |
| Qcache_total_blocks     | 1        |
+-------------------------+----------+
8 rows in set (0.01 sec)

Bulk edit price in Magento with SQL query

Select Prices

SELECT 
catalog_product_entity_decimal 
WHERE
catalog_product_entity_decimal.attribute_id=75  

Update Prices with Value

UPDATE 
catalog_product_entity_decimal 
SET catalog_product_entity_decimal.value = 35.9500
WHERE
catalog_product_entity_decimal.attribute_id=75  

(catalog_product_entity_decimal.attribute_id=75 = price)

Empty Value

UPDATE 
catalog_product_entity_decimal 
SET catalog_product_entity_decimal.value = NULL
WHERE
catalog_product_entity_decimal.value_id=120

Update Prices with %

UPDATE
catalog_product_entity_decimal
SET
catalog_product_entity_decimal.value = catalog_product_entity_decimal.value*1.19
WHERE
catalog_product_entity_decimal.attribute_id=75
OR
catalog_product_entity_decimal.attribute_id=76;

1.19 is 19% tax
Id=75 is the price
Id = 76 is the special price (see table eav_attribute table for codes)

Update Prices with Rounded Value

UPDATE
catalog_product_entity_decimal
SET
catalog_product_entity_decimal.value= ROUND(catalog_product_entity_decimal.value,0)
WHERE
catalog_product_entity_decimal.attribute_id=75
OR
catalog_product_entity_decimal.attribute_id=76;

Run this if you want all your prices to be also rounded e..g 25.00 instead of 25.01

Now Refresh Cache in Magento

Magento Import Products

  • Go to Magento Admin > Catalog > Manage Categories
  • Add your Product categories here but do note your category ids, you can make a list of your category ids in a notepad file.
  • There might be a possibility that you need to define extra attributes for your products so for that go to Catalog >Attributes >Manage Attributes and click Add new Attribute. You can also save your Attributes sets based on the attributes you have defined.
  • Now go to Magento Admin > Catalog > Manage Products
  • Add four to five products manually.
  • Now go to Magento Admin > System > Import/Export > Profiles
  • Click Export all products.
  • In Data Transfer choose Local/Remote Server (If you choose remote ftp, then you will have to provide the ftp information)
  • Any select Local Server (though its upto you) and click Save Profile.
  • Now click export all products again and then click Run Profile on your left.
  • This will save a csv file of your manually added products on to your local/remote folder
  • Download that csv file on to your computer using any ftp client (filezilla).
  • You will have a csv file having columns of all the product attributes such as store, websites, attribute_set, type, sku, category_ids, has_options, name,meta_title etc
  • Populate these columns with your products and add the category ids that you had already saved in a notepad file in category_ids column to properly assign the products to their respective categories.
  • When you are done, go again to Magento Admin > System > Import/Export > Profiles and click Import all products this time.
  • Click Upload file, browse for that csv file and then click Save Profile. (Or you can upload the csv file via ftp client such as filezilla to var/import folder)
  • Now again click Import all products, click Run Profile, Select the csv file that you have uploaded from the drop down and then click Run Profile in popup.
  • Products will start importing into your Magento Store

Problems with the import/export feature ?

I got the import/export business working by:

1. Using the default Export All Products profile and making sure to set the file name ending to .XML not .XLS
2. Using Excel to edit the file.
3. Using the default Import All Products profile to import.

Magento Admin menu werkt niet meer

Zojuist een upgrade gedaan van een magento installatie naar een nieuwe versie via Magento Connect

Na de upgrade bleek de admin menu niet meer te werken in de backend.
De oplossing bij mij was het Head.php bestandje te vervangen.
Bestand staat in app/code/core/Mage/Page/Block/Html/

Download hier het  Head.php bestand voor de oplossing : Head.php