Yii 1.1: yiishop

A simple, but full featured, i18n, extensible Web Shop for easy integration into your Yii Web Application


Yii-Shop is alive again! I added a SVN repository at Google Code: http://code.google.com/p/yii-shop/

This extension is a simple, but full featured, internationalized, extensible Web Shop for easy integration into your Yii Web Application...


  • Server-side Shopping cart via Session
  • Customizable Product specifications (weight, color, material, size, ...)
  • Customizable Variations (product t-shirt, variation: red, blue, yellow; small, medium, huge)
  • Tax system (7%, 19%, ...) VAT
  • Customizable shipping methods
  • Customizable payment methods
  • Generate Invoice and Delivery slip automatically with good template, can be customized to fit your company needs
  • 100% Translated to english, german




  • Yii 1.1 or above

detailed Documentation

Detailed Documentation is provided with the package unter the docs/ directory. There is also a Mysql Workbench .mwb Schema available.


To install this module, follow the following steps:

1.) extract the file under the modules/ directory of your Web Application

2.) set up the Module in your protected/config/main.php:

return array(
 'modules' => array('shop' => array( 'debug' => 'true')),

3.) run /shop/install in your Web Browser

4.) follow the on-screen installation instructions

5.) Create an empty directory containing your Product Images. By Default, this is approot/productimages. Make sure it is writable by your Web Server Process.

6.) After Installation, make sure to remove the 'debug' => 'true' in your Configuration.

7.) Read docs/config.txt for Configuration Options


Just run http://your_app/index.php?r=shop/products/index for the frontend and http://your_app/index.php?r=shop/products/admin for the backend/Admin interface.

Note that this Module does NOT handle User/Admin authentification. You have to do this by yourself, either by CAuthManager, CDbManager, the yii-user-management or the srbac Module. Instructions on how to integrate this Module with the Yii User Management Module will be available soon, it is already prepared

Change Log

March 15, 2011

0.7rc3 * much new things

February 13, 2010

0.5 * still alive * minor bugfixes

0.4 alpha * Added Installation routine * added german i18n Strings

February 4, 2010

0.1 alpha * Added shopping Cart * Added Ordering & Ordering administration * Added (primitive) Price Calculation

February 1, 2010

  • First development snapshot

Total 20 comments

#18021 report it
viktor_au at 2014/08/27 03:57am
Cannot create new or update product

Please check you controller. Have you done the permissions setup correctly? ................................... public function accessRules() array('allow', // allow admin only 'actions'=>array('admin','create','update','delete'), 'users'=>array('admin_my_site'), ), ..................................... Where admin_my_site is you or your admin name to log in.

#18008 report it
Larry Jr. at 2014/08/26 02:09am
Cannot create new or update product

When i tried to add new product it only showed this this printscreen

how do we fix it? Thanks

#17987 report it
moginn at 2014/08/22 11:14pm
lots of errors

I have SQLite database and I got an Exception in the install script. Then I changed to MySQL and worked fine. I ran the program and, to be honest, I expected something else. Moreover I got an CException when purchasing the products -> Please specify the "data" property.

#17478 report it
Todd Anstis at 2014/06/18 05:50pm
The table "shop_category" for active record class "Category" cannot be found in the database.

To anyone having this issue - for some reason the default layout for the Install controller has elements that reference several ActiveRecords that (obviously, since you haven't installed the module yet) haven't been created yet. Change the layout to something other than the "shop" layout and you should be able to install fine.

#17177 report it
viktor_au at 2014/05/09 08:12am
About themes....

About themes.... In my situation the folder themes is outside the protected folder. In this folder you have to have another folder, say, folder shop (can be any name). Usually in this folder you have to have a folder css (for css files (for example: main.css)), a folder for views, inside it another folder: layouts (with main.php file). Then you have to add in each of your shop controllers (at the bottom of the controller page): **Yii::app()->theme = 'shop'; **

I think if you search the web you can find a free yii themes. You just tailor them to your needs.

#17174 report it
333ashok333 at 2014/05/09 06:57am
How to load themes to this module..??

great work by the developer ... but how can i load the themes or how can i load the theme of main web application into this module?? pls can any one help me..??

#17173 report it
333ashok333 at 2014/05/09 06:56am
How to load themes to this module..??

great work by the developer ... but how can i load the themes or how can i load the theme of main web application into this module?? pls can any one help me..??

#16261 report it
viktor_au at 2014/02/04 01:57am
yii shop user table doesn't exist.

Hi phamdoan. Please read the installation more carefully. The creator of yiishop wrote:....

Note that this Module does NOT handle User/Admin authentification (!!!). You have to do this by yourself, either by CAuthManager, CDbManager, the yii-user-management or the srbac Module................................. I can make a suggestion: download a yii-user extension (http://www.yiiframework.com/extension/yii-user). Please read the installation instructions very carefully. Please have a look at info from: http://www.benjaminlhaas.com/blog/installing-yii-users-and-rights-5-steps. Please don't rush with yiishop. Take you time. Do it slowly.

#16257 report it
phamdoan at 2014/02/03 07:40pm
can't get di customer_id

in _form.php on customer view have function

<?php echo $form->textField($customer, 'user_id', array('value'=> Yii::app()->user->id)); ?>

them I insert data , on database null , can you help me !!

untitled - Upanh.com

#16145 report it
viktor_au at 2014/01/23 04:10am
What error phamdoan?

What error? You cannot see the table with text? Or You cannot render partial the view.php?

#16112 report it
telvin at 2014/01/21 02:32am
Table cannot not be found error whilst installing process

@leo4all: In order to fix that error, you have to update the InstallController.php

public function actionInstall()
        $this->layout = false; //instead of setting it to '' as what original version did 

I guess the Yii framework version what you were using, it automatically check if layout is empty, it would set it back to default layout (application.modules.shop.views.layouts.shop), and there is line which invoke the active record in that view, it meant that the application would load the necessary models inside your module while the db was not installed yet. Therefore you should set it into false instead.

#15930 report it
viktor_au at 2013/12/31 01:10am
shop customer validation

One more thing.

As I found out.

There is a difference between validation of different models (as Address, Customer and User (if you use user models)).

If you:

if(isset($_POST['Customer'], $_POST['Address'], $_POST['User'])) // and you: if($customer->validate() && $address->validate() && $newuser2->validate()) // if validated.

then you better validate it before you: if($newuser2->save()) ... if($address->save())

... if($customer->save()) //


... and... you better populate the model // for example

// if...

//.. $customer = new Customer;

//.. else... // .. when form is reloaded, get the posted values...

if(!isset($customer)|| $customer === null)

$customer = new Customer;

//else $customer = $_POST['Customer']->email;

//else $customer->attributes = $_POST['Customer']['email'];

else $customer->attributes = $_POST['Customer']; // fill up the form

// and so on..

// don't forget to add values in reload form situation:

if(!isset($address) || $address === null)

$address = new Address;

else $address ->attributes = $_POST['Address'];

// fill up the form with old values

#15913 report it
viktor_au at 2013/12/28 06:43pm
Register customer form no validation change


public function actionCreate()

 if($model = Shop::getCustomer()) 
        $address = $model->address;

           $model = new Customer; 
           $address = new Address;

        if(isset($_POST['ajax']) && $_POST['ajax']==='customer-form')
            echo CActiveForm::validate(array($model,$address));

                ////////////// more code




// change to true


// Note: add to form file:

'htmlOptions' => array('enctype'=>'multipart/form-data'),
#15506 report it
saurabh_patil at 2013/11/16 03:13am
Yiishop product categorizatopn

I am facing problem of grouping products of same category as well as grouping same product added to shopping cart. Is there any admin side setting for it or do i write query for the same ?

#15439 report it
viktor_au at 2013/11/10 01:11am
Fatal error when creating or updating a category

No error when the relation widget is deactivated. The Relation widget is used in forms, where the User can choose between a selection of related elements. It automatically renders a Selectbox or Listbox. . $this->widget('application.modules.shop.components.Relation', array( 'model' => $model, 'relation' => 'category', 'fields' => 'title', 'showAddButton' => false));

#15353 report it
viktor_au at 2013/10/31 03:44am
Fatal error when creating or updating a category

Please help me to figure out the problem with creating or updating the category. I can delete the category without any problems. Not when I try to update it... In this case I have the message: Update Category 2 Parent
Fatal error: Cannot re-assign auto-global variable _POST in

#15098 report it
RIazul Ivan at 2013/10/07 07:35am
help to disable Shopping cart, payment method and all user can add product system

Dear author, nice extension. its really help and reduce a lot of time. but can u please help in some other things: such as if i want to disable the Shopping cart and payment methods then what to do in code.. and also if i want to enable product adding system to all user, then what to do... please help.. Ivan

#14515 report it
jward at 2013/08/19 05:31pm

I usually use a tablePrefix of "tbl_". In this case, I had to use "shop_" as this is what gets installed.

            'tablePrefix' => 'shop_',
#14262 report it
yurichan at 2013/07/30 12:48pm
shop database tables do something strange with activeform in IE9? submitting twice

I have a strange issue when I installed the Yii shop module.

I have another module called page and after I go to the create action of the controller fill in the ActiveForm and press submit to create a new model. The "actionCreate" function gets executed twice. That is in IE9, however in Chrome it only submits once.

After deleting the shop tables from the MySQL database. And going again to the ActiveForm creation page and submitting the form. It only submits once in IE9 now.

I debugged it. And it has to be related to the shop tables somehow. Because if I insert them again. This time without constraints. (There are no constraints in my database). It again submits twice. How is this possible?. Also nothing in the console to suggests errors. I am lost here.

#13847 report it
asifrafeeq at 2013/07/01 03:28pm
great effort
  • first make new yii application
  • creat module folder i.e protected/module and extract the yiishop folder named "shop".
  • go to protected/config/main.php and add the code under module array
'shop' => array(
            'debug' => true,
            'loginUrl' => array('/user/auth'),
            'currencySymbol' => '€',

  • no need to create the database manually, it will create dynamically.
  • localhost/yourapplicationname/index.php?r=shop/install/index ,

  • you will see the configuration page... just install it ...

  • http://localhost/yourapplicationname/index.php?r=shop/products/admin,you can set the back end stuff

  • thumbs up for the developer for one of the great effort.

Leave a comment

Please to leave your comment.

Create extension