Skip to content


PHP Synchronous and Asynchronous SoapClient

Asynchronous PHP Soap Client

* PHP does not support multithreading and asynchronous programming.

The purpose of this project is to have an Asynchronous SoapClient that allow us to perform multiple requests to SoapServer.

Almost all the companies that provide services using SoapServer and alot of them provide asynchronous Soap Api but Usually it very poor and it lack the real-time response and its poor comparing to the synchronous Soap Api.

So This class asynchronous soap php will allow you to be able to use different asynchronous Soap Implementation! that work with Synchronous Soap Api !

See the Examples to see how to use it.

Features

  • Client can work in Asynchronous (multi) and Synchronous (single) mode.
  • Multiple calls using curl_multi_exec, Doesn’t wait for soap consecutive calls ! This client will save alot of time and resources doing multiple requests at same time !
  • Each Request has hash id which is unique to each request ( If you execute the same request 100 times more, it will have the same hash ) so no duplicate requests
  • Very Easy to debug every single point during the request! also ability to use CURL_VERBOSE to debug the connections to the Soap Host
  • Very easy exception handling in async mode

Find the code is on GitHub Repo

Posted in General, PHP.

Tagged with , , , , , , .


Magento Error “You cannot define a correlation name ‘link_attribute_position_int’ more than once”

After Migration from old Magento Version to newer Magento Version,
Some times When you try to duplicate product from Catalog -> Products -> Duplicate
You get this Error

You cannot define a correlation name 'link_attribute_position_int' more than once

Well this error indicate that you have Duplicate attribute position link in Database table
catalog_product_link_attribute
So when the duplicate method try to duplicate the product it looks into the folder and duplicate the attributes in that table, By Default the attributes in that table are ( Position, Qty )

So to solve this Error check duplicate rows for link_type_id = 3, Query is
SELECT * FROM `catalog_product_link_attribute` WHERE `link_type_id` = '3'
Then Delete the duplicate rows from the Table and make sure it looks like the screen below

Posted in Magento, MySQL.

Tagged with , , , .


Exclude Files/Folder from commit to specific branch git

Using git hooks !
Here is working example ” I have tested it and made sure it works fine ”
Usage :

git add . // add all the files for example ( including the files you want to exclude )
git commit -am ‘Test pre-commit’ // commit all the files “pre-commit” hook will run

Directory Structure example

Create file in your git root directory and call it { .ignorefolders } with files or folders you want to exclude ” example below ”

I have added “/” at the beginning of each line as i wanted it to be relevant to the root dir
” You can add complete folders, individual files ”
Create file { pre-commit } in folder { .git/hooks } with content below

Notes :

Code is well documented ( You can use exit or return ) in the conditional statements depends on the logic you want !

Use-case :

If you add “git-add .” and all the files you added is excluded in the config file “.ignorefolders”, Then you try to commit!
The files will be removed from the commit but you will be able to commit an empty “without any changes” commit.

Posted in General, Git.

Tagged with .


Use Single or Multiple ( Slave or Master ) MySQL Databases with Magento | Magento Optimization

I have decided to write a series of magento optmization and performance tuning, and i will start with this subject as first article.

This articles will be different from the ones you see it on the internet !! it will be unusual solutions, different, solving real problems and achievable on all hosting and development platforms !

Assuming you have correct replication setup of your databases. ( slave_1,slave_2,slave_3 etc… )

The below solution will allow you to Alternate customers to USE ( Read ) data from different databases so you don’t have high load on one database.

- Step 1:

In File
app/etc/config.xml

Find “core_read” Closing tag

Add After the closing tag ( as many as databases you want to use ) it should look like below:

- Step 2:
And Add the new connection in your apt/etc/local.xml after ( “/default_setup>” closing tag )

- Step 3:
Copy the File From ” app/code/core/Mage/Core/Model/Resource.php ” == TO ==> ” app/code/local/Mage/Core/Model/Resource.php ”

1- Find protected $_mappedTableNames;

2- Add this method below :

3- Modify the method ” public function getConnection($name) ” to Look like below :

This will allow you to use as many as databases you specify in the XML and PHP CODE for core_read connection and the default_setup connection for all other connections in magento ( core_write, core_setup )

Posted in Magento, MySQL, PHP.

Tagged with , , , .


Infinite Scroller Ajax Products Magento

Description:

This extension is for when the user reaches the end of the current product list, the next page is loaded automatically by AJAX after the end of the list. Easy to install and configure, this module works 100% out of the box with Magento’s default theme, and also gives to you the posibility to configurate the custom selectors of your custom theme. Now you can get a more friendly UI by helping the user to save clicks and time.
Tested and working with Magento CE 1.5+… 1.7.0.2 , and Magento EE 1.10+.. 1.13.0.1

Features:

* Minimize category page load time significantly in Magento!
* Very easy to configure and to adjust for different themes.
* Works with sorting/filters.
* Super blazing fast, light weight as its only load products without any other blocks/models/etc..

Installation:

  • Download from githubt repo or Magento Connect.
  • Configure the options for your theme on System / Configuration /Catalog / Ajax Products seccion.
  • Scroll to infinity and beyond!

Configuration:

If you have a different theme other than the default, you will need to copy the default theme files to your custom theme folder and configure the plugin by going to System / Configuration / Catalog / Ajax Products.

Screen shots

Category page

Configuration Backend

Posted in HTML, Javascript, Magento, MySQL, PHP.

Tagged with , , , .


Get all product attributes for a magento object using MySQL

The below MySQL Query allow you to get all the product attributes for specific product by its sku or id, change “YOUR_SKU” to the product you want to get.

Posted in Magento, MySQL.

Tagged with , , , .


Add/Edit/Remove Regions in Magento address region/state/city field

Manage regions in magento addresses

Magento provides country and region* as dropdown option in addresses This module provides flexibility of managing this regions for each country with its locale translations.

Very Easy to use ( it allow you to edit in place all the values ) hover and click on the value so you will be able to edit in place ( look at the screen shots )

Test and working with Magento CE 1.5+… 1.7.0.2 , and Magento EE 1.10+.. 1.13.0.1

  • Usage :1 – Install the Module2 – Go to Menu CMS -> Country States

You can download it from Magento Connect website
http://www.magentocommerce.com/magento-connect/catalog/product/view/id/18954/

OR
Check the module on github HERE https://github.com/Meabed/magento-regions-manager

Check the scren shots:

Inline Edit

Edit Region

Inline Edit

Grid List of regions

You will see the grid and how easy to modify the Regions/state for each country and its translation for each locale in your system.

Posted in Magento, PHP, Zend Framework.

Tagged with , , , , , , , .


Promotions don’t apply to downloadable files prices in Magento

Initial conditions:

  • Magento 1.7 installed (haven’t tried with previous versions)
  • One (downloadable) product with multiple downloadable files, with prices added to the default product (let’s say product that costs 50$ + 2 downloadable files, one free, the other an extra 50$ )
  • A new promotion (Catalog price rule) that applies to all products (let’s say -20%)

More info about promotion:

Applies to all products, all groups, is active and applied, applies ‘by percentage of original price’, enable discount for subproducts -> Yes, stop further rule for processing -> No
Expected result:

Price for the product with the 50$ file: 80$ (80% from 100$)

Actual result:

Price for the product with the 50$ file: 90$ (80% from the initial 50$, and the full price for the downloadable file).

Conclusion:

The promotion doesn’t apply to the extra prices that downloadable files have.

Question(s):

  • Is this the desired behavior for downloadable files? Or is this a bug ?
  • Any tips on how to modify the code (eventually create a module) to make it work as expected ? (Just tips, ie. what to extend)

Answer:

Links / downloadable files its not products entities ( so it doesn’t have price_index table and it doesn’t treated as products )

There is 2 Ways to apply promotion in products

1. Catalog Price Rules

2. Shopping Cart Price Rules

As your question stated that you used Catalog Price Rules I have solved your question using Catalog Price Rules.

Create Module and rewrite the Model

Mage_Downloadable_Model_Product_Type

======

and the Code Below calculate the price of each Link on the fly ( even if you have more than one rule applied to the same product )

* This not a bug, this is intended functionality as the linked product designed different from the catalog products.

Posted in Magento, PHP.

Tagged with , , , .


Magento Adding existing attribute to all attribute sets

Question :
I have an existing attribute for an embed code. I need to associate this attribute with 120+ existing attribute sets.

If I know the attribute set id, how can I go about adding the attribute to all attribute sets programmatically?
========================================
Solution :

I have found it interesting to write code for this issue so here is the solution that works :)

Run this code in php script including mage.php and let me know if it works well.

replace ( firstname ) with the attribute code that you want to mass add to all attribute sets

Posted in Magento, PHP.

Tagged with , , , .


Add Additional Payment Information In Admin -> Sales -> Orders -> View

Hi,
I have ran through a case when i was integrating payment method and I wanted to add additional information in adminhtml view order in sales.
I have found 2 ways of doing this:-
1- Add info.phtml ( Mage_Payment_Block_Info ) and set the template file

2- Adding Additional Payment Information in the payment table which i preferred because i didn’t want to create template etc…
So I implemented 2 methods with events as follow
config.xml

And in the Observer.php
The 2 methods implemented as follow :

Posted in Magento, PHP.

Tagged with , , .


Paypal Multi Currency Magento

Paypal Multi Currency Magento

https://github.com/Meabed/Paypal-Multi-Currency-Magento

This module is for Magento 1.7+ to Support Paypal payments for not supported currencies by paypal

After Installation go to System -> Configuration -> Payment Methods -> Paypal Multi Currency

And configure the module on your choice !

Feel free to contact me for inquiries,issues and feedback

Posted in Magento, PHP.

Tagged with , , .


Terminal PS1 Colors !

Among all the terminal colors out there my favorite one is :
Example Colors :

However Here is some useful information in the Manual :

Color escape code general syntax:

Foreground colors

Background colors are 40, 41, 42, etc.

Text styles:

Reset to plain (always put at the end!):

Available variables:

Posted in General, Mac OS.

Tagged with , , , .


Set default category product position magento

So in one of my projects i wanted to change the default Category product position in the admin grid when you assign new product to category
The data sent as array of ( product_id => sort position ) and its been generated in from Javascript function in

So you can modify this function to assign the position input different default value when you check this product to be assigned to the category.
The modified function will look like this

Posted in HTML, Javascript, Magento, MySQL, PHP.

Tagged with , , , , , .


Change decimal attribute to int in magento !

Hi,
I was doing some work for client, and i have seen they created a decimal attribute as currency and they were already using it as int ! so the one who created it didn’t know actually what he is doing. anyway i have decided to convert to INT and ofcourse keeping the same old values as its.

So here is MySQL script the convert the attribute ( in my case the attribute_id = 168 change it to be the attribute you want to change !)

CHANGE THE ATTRIBUTE_ID TO MATCH THE ATTRIBUTE ID YOU WANT TO CHANGE !!

——————

Then get the old values from decimal EAV table and insert them into the EAV int table

Run this code if you want to have DEFAULT value for all other PRODUCTS that have no value assigned to this attribute
In my case the default value = 10000 // CHANGE IT TO WHAT YOU NEED

Posted in Magento, MySQL.

Tagged with , , .


Add a custom option to a quote item magento

Yes this is possible, you need to use the observer

I have been adding Delivery date with each product in the orders

So you can change this to be the Option you want to add to each product or so.

———-

Posted in Magento, PHP.

Tagged with , , , .


Get EAV attribute id,name,.. from attribute code in magento

Hello,
Something useful we always use if you want to join some attribute or sort by etc.. you need to get the attribute info! and this is helper function to do this.

Posted in Magento, PHP.

Tagged with , , , .


MIGS Payment Integration with Magento

Hello,
Three months back i have written magento payment module integration with MIGS because this merchant is most used in Middle East ( arab country ),

It has option to auto-check payments and update orders accordingly through migs API.

You can find it in Github.

https://github.com/Meabed/MIGS-Magento-Module

I am also working on Cashu CPSP Integration with magento, I will release it soon !

contribution and comments are most welcome.

Posted in Magento, PHP.

Tagged with , , , , .


Send New User Email Confirmation to specific email address domains

If you want to Send New User Email Confirmation to specific email address domains, You can extend or Override

So you can do it in both ways

Enable Activation email and set $customer->setIsConfirmationRequired(false); if the email didn’t match the domain you want to validate ( Recommended )

Disable Activation email and set $customer->setIsConfirmationRequired(true); if the email match the domain you want to validate

Thanks

Posted in Magento, PHP.

Tagged with , , , .


Create states and zones for countries in magento

Yes Its possible to Create states and zones for countries in magento,

But you need to make script that inset new Items in the table called

Inset as many as you want, you will find them everywhere in the checkout/shipping quote etc..

Thanks

Posted in Magento, MySQL.

Tagged with , .


Magento admin panel 404 after successful login

I have this problem when i had custom admin routing WITH Multi store view as well

I had the issue when i go to http://dev.loc/magento/myadmin/ { i have 404 after login }

But if i used http://dev.loc/magento/storeview/myadmin/ { this works fine }

After debugging this i found that in \app\code\core\Mage\Adminhtml\Controller\Action.php

When you have successful login this IF condition yield false
so this statement that set the redirect after successful login doesn’t run

So You could extend the Mage_Adminhtml_Controller_Action

and Override the Pre-dispatch function Or You this observer adminhtml_controller_action_predispatch_start to set The redirect Page

Thanks

Posted in Magento, PHP.

Tagged with , , , , .


Convert Attribute drop down to multiselect Magento

Hi,

Today i wanted to convert a drop-down existing attribute to multi-select attribute in magento.

after checking the DB structure i have come up with working MySQL Queries that do the job perfectly.

  1. First thing you need to know the attribute ID you want to convert ( in my case it was 143 )
  2. Run those queries and replace the attribute_id = 143 with the Attribute ID you want to change !

Comment or contact me if you need any help, Happy Coding !!

Posted in Magento, MySQL.

Tagged with , , .


Magento Services

Magento Services : magento is an open source eCommerce solution. It comes with a variety of tools, necessarily for building a successful online shop.Magento supports installation of modules through a web based interface accessible through the administration area of a Magento installation. Modules are hosted on the Magento eCommerce website as a PEAR server. Any community member can upload a module through the website and is made available once confirmed by a member of the Magento team. Modules are installed by entering a module key, available on the module page, into the web based interface.

Magento main features:

Analytics and Reporting - the script is integrated with Google Analytics and offers many different reports.

Product Browsing - multiple images for products, options for extensive reviews, wishlists and much more.

Catalog Browsing - easy navigation, advanced product filtering system, product comparison.

Catalog Management - inventory management, batch import and export of products, different tax rates per location, additional product attributes.

Customer Accounts - order status and history, e-mail and RSS feeds for products in the wishlist, newsletter subscription, default billing and shipping address.

Customer Service - enhanced features for customers’ accounts, Contact Us form, comprehensive order tracking and history, customizable order e-mails.

Order Management - create orders through admin area, create multiple invoices shipments and credit memos, call center order creation option.

Payment - different payment methods: credit cards, PayPal, Authorize.net, Google Checkout, checks, money orders, support of external payment modules like Cybersource, ePay, eWAY and many more.

Shipping - shipping to multiple addresses, flat rating shipping, supports UPS, UPS XML (account rates), FedEx (account rates), USPS and DHL.

Checkout - one page checkout, SSL support, checkout without having an account.

Search Engine Optimization - 100% Search Engine Friendly, Google SiteMap support.

International Support - multiple languages and currencies, list of allowed countries for registration, purchasing and shipping, localization.

Marketing Promotions and Tools - coupons, discounts and different promotion options.

Site Management - control of multiple web sites, multiple languages, tax rate with support for US and International markets, customizable outlook through templates.

Magento eCommerce platform is a highly efficient open source eCommerce engine.

It offers you an extensive suite of powerful tools for creating and managing an online store. Magento runs on the Apache/MySQL/PHP platform and to create an online store with it you need reliable web hosting services. Support for Magento shopping cart is provided free by an active open source community, professional support by subscription to Varien, the company behind Magento, is cost charging. The large array of the rich features is one of the main benefits of Magento

Magento shopping cart is built to be easy to update:

The issues why so many people opt for Magento shopping cart are rather diverse. The thing is that Magento is a new eCommerce solution which is being regularly improved. Varien, the company who backs the cart, is very active in updating the code and fixing bugs. At the same time osCommerce is rather outdated and it doesn’t surprise web developers and store owners with the new updates. Magento is superior to osCommerce in the useful features it has, programming structure, and frequency of project code updates.

Magento has many add-on modules within the rest of new and important capabilities

The feature set for Magento includes not only all of the features of osCommerce, but also many of the add-on modules. For instance, it includes coupons, order editing, SEO urls and meta tags, abandoned shopping cart reporting, product comparisons, editable order emails, shipping estimator in shopping cart without the need to login, and much more. Magento also has ‘store view’ which allows online shop keepers the ability to set up multiple stores – with the same products, at different prices, and even in different languages – from a single admin area.

Magento offers well organized back-end along with cleaner site structure :

People prefer using Magento for the cleaner admin, code, and much more. Magento system scores highly for its look and sensible overall features. Its back-end is well organized and most items of concern are thoroughly covered. Talking about osCommerce, some people admit that its code is a real mess and the back-end is really pitiful. Others mention that the structure of the site, written in PHP and using clear definitions, is rather sensible with all the text seen on an osCommerce store being handily stored in reference files which contain only plain text for translation. All in all, osCommerce is known to be easy to install but a real pain to configure and customize.

Magento Nice default template :

Magento templates and themes enable the owners to customize the look and feel of the store, even optimize it for mobile phones. Modular code enables them to upgrade the Magento installation while retaining their customizations. At the same time installing an osCommerce template is not an easy task. osCommerce does not support a template installer option. Installing a new template for osCommerce is actually a new installation of the osCommerce files. So, there is no graphic template system meaning it is harder to modify the design to adjust the style and layout. Additionally, it can take a lot of time and money to install all the add-ons you want. osCommerce, by the way, has the most available number of contributions and modifications which is a way beneficial.

Magento Connect:

“Magento supports installation of modules through a web based interface accessible through the administration area of a Magento installation. Modules are hosted on the Magento eCommerce website as a PEAR server. Any community member can upload a module through the website and is made available once confirmed by a member of the Magento team. Modules are installed by entering a module key, available on the module page, into the web based interface. There are three categories of modules hosted on Magento Connect:

* Core Modules

* Community Modules

* Commercial Modules

Core and Community modules can be installed via the administration area.

Posted in Magento.

Tagged with , .


Magento Vs OsCommerce Comparison for Online Store Owners

Magento and osCommerce both allows store owners to maintain their online stores with minimum effort. Magento & osCommerce are eCommerce open-source shopping cart applications and both are packed with all the features needed to create a successful web store. We have composed this article to help you to know the advantages and disadvantages of each platform. So checkout the comparison of these two eCommerce applications to see which one is better for your online stores, because it is important to know when selecting your shopping cart what features you need.

osCommerce is a free open source online store-management software which is powered by very well established and responsive osCommerce community. To run any osCommerce website the web server should support the powerful PHP web scripting language and fast MySQL database. osCommerce offers a wide range of features that allows online stores to be setup fairly quickly with ease.

Magento is a highly efficient open source eCommerce platform. It offers you an extensive suite of powerful tools for creating and managing an online store. Magento runs on the Apache/MySQL/PHP platform and to create an online store with it you need reliable web hosting services. Support for Magento shopping cart is provided free by an active open source community, professional support by subscription to Varien, the company behind Magento, is cost charging. The large array of the rich features is one of the main benefits of Magento. Magento comes with enterprise-level features and quality of build. It lets you control every facet of your store, from merchandising to promotions, and there are no limits to creativity with Magento which allows us to create stunningly beautiful eCommerce themes for Magento that will improve your brand’s visibility adding trust to your e-business and improving sales with SEO effort put into developing them.

Advantages and disadvantages of Magento over osCommerce:
• Magento needs dedicated servers from particular hosting providers in order to run fast shops while shared web hosting account will be enough for osCommerce.

• Magento has many add-on modules within the rest of new and important capabilities. The feature set for Magento includes not only all of the features of osCommerce, but also many of the add-on modules. For instance, it includes coupons, order editing, SEO urls and meta tags, abandoned shopping cart reporting, product comparisons, editable order emails, shipping estimator in shopping cart without the need to login, and much more.

• Magento shopping cart is built to be easy to update.

• Magento runs fairly slow, heavily layered and overly complicated coding style and thousands of files requires a lot of time to learn and do customizations.

• Magento offers well organized backend along with cleaner site structure. Its backend is well organized and most items of concern are thoroughly covered. Talking about osCommerce, some people admit that its code is a real mess and the back-end is really pitiful.

• Magento is a new solution which is regularly improved. Web developers and store owners look forward the new releases of Magento. OsCommerce is rather old and it doesn’t surprise its owners with new updates.

• All in all, osCommerce is known to be easy to install but a real pain to configure and customize. Magento project has revolutionized eCommerce with its flexibility and power. It takes the best things from osCommerce such as being open source, easy to modify, and having a strong community, but then takes these to the next level of sophistication. Magento developers practiced all the advantages of the last time to shape web application incorporating the richer user interface and better ergonomics.

Also check out the following features’ list for Magento and osCommerce:

• Unlimited Products
Magento: Yes
osCommerce: Yes

• Edit Products
Magento: Yes
osCommerce: Yes

• Admin Can Edit Products In Order
Magento: Yes
osCommerce: No

• Product Attributes
Magento: Yes
osCommerce: Yes

• Multiple Product Images
Magento: Yes
osCommerce: No

• Coupons
Magento: Yes
osCommerce: No

• Edit Customers
Magento: Yes
osCommerce: Yes

• Different Pricing Per Customer Groups
Magento: Yes
osCommerce: No

• Supports SSL
Magento: Yes
osCommerce: Yes

• Spreadsheet Database Upload
Magento: Yes
osCommerce: No

• Graphic Template System
Magento: Yes
osCommerce: No

• SEO Tools for meta tags and URLs
Magento: Yes
osCommerce: No

• Live Shipping Quotes
Magento: Yes
osCommerce: Yes

• Google Checkout Pre-installed
Magento: Yes
osCommerce: No

• Content Management System for Informational Pages
Magento: Yes
osCommerce: No

• PayPal
Magento: Yes
osCommerce: Yes, but not IPN

• PayPal Pro
Magento: Yes
osCommerce: No

• SEO Tools for meta tags and URLs
Magento: Yes
osCommerce: No

• Multi-Lingual Support
Magento: Yes
osCommerce: Yes

• Multi-Currency Support
Magento: Yes
osCommerce: Yes

• Multi-Store Support
Magento: Yes
osCommerce: No

Posted in Magento.

Tagged with , , , , , .