News: ¶
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...
Features ¶
- 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
Resources ¶
Documentation ¶
Requirements ¶
- 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.
Installation ¶
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
Usage ¶
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
Bug?
Hi thyseus,
this is a really nice extension and I like to see more features of this in the future.
This could become an awesome extension for websites.
Greetings Jan
hi and thanks for your interest in yii-shop
i hope so, too. you can watch the development at the google code svn repository. at the moment i do about one "big" commit every two days on average. I will also do a new release of 0.6 if i think it is stable enough and has enough new features.
Development
Hi,
great to see this extension making huge progress.
This could be a very good extension to push even yii itself.
Yii with an internal Shop System would be much more than other systems I know.
Only the Features are the limit ;-) ... but this is making progress too.
Keep up the good work please.
Greetings tronga
Great, will definitely find time to try
Theseus's releases of exts are good and worthy. I haven't tried this one but so excited to have a shopping cart ready in Yii. I don't have any project to use it so prefer you keep it simple in features but improve the base/core system.
Thanks
hm
Alias "shop.ShopModule" is invalid. Make sure it points to an existing PHP file.
???
Re: "Alias "shop.ShopModule" is invalid"
Ensure that you've uploaded the contents of the 'shop' directory into your modules/ directory and that it's visible to the web server.
If your module name and the folder name don't match, or if the folder is missing, you'll get that message.
Incredibly broken so far
Not looking good so far.
Install is completely broken, the models are trying to find their corresponding tables before install.
You should really make a sub layout so too, similar to how a generated Yii skeleton app has column1 and column2.
Also......
I noticed some weirdness in routing...
You go from:
DefaultController->actionIndex()
to
ShopController->actionIndex()
to
ProductController->actionIndex()
In Controllers you can set defaultAction (by default it is set to 'index')
In Modules you can set defaultController (by default it is set to 'default')
Integration with yii_user_management
When can we expect the 'Instructions on how to integrate this Module with the Yii User Management Module'?
I am starting a yii ecommerce web application, and am looking forward to using both your yii_user_management and yii_shop modules.
Thanks
Abhinav
Abhinav
If you enable this option and have YUM installed, you have the possibility to let the user choose if he wants to register an account automatically while buying at your webshop. If an account already exists, he is prompted to log in. If logged in, he can see his orders and the status.
When planning to use this feature, please make sure to
1.) use the latest SVN version of BOTH extensions
2.) Give me a lot of feedback if it works ;)
i use this in production on two web-shops. Well, why not mention them. It is http://www.lichtkegel-fotografie.de and http://www.fotolieferservice.de
good luck ;)
p.s. write me at thyseus@gmail.com or in the google code issue tracker, thank you
DarkSNF
Yes, you are absolutely right. A layout for installation is necessary. Sorry for that trouble.
currency
Can I change currency to euro in webshop? Thanks.
NICE idea, shame about the license
Try the BSD licence and we may show a little interest.
Installation Tip
I tried to install this module but was hitting error about category table is not found etc.
The fix is to go to layout folder, create an empty file, like empty.php
Now, head over to InstallController, and change $this->layout = 'empty';
It seems to me that by setting $layout = '', yii actually ignores the setting and use the default shop.php layout instead.
Demo Tip
If you are trying to access
/shop/products/view/id/1 and hit 404 not found error
Go go phpmyAdmin or MySQL client of your choice, and go to shop_products (or the name that you set for products table), and update all rows' status column value to 1
update `shop_products` set status = 1
why don't you run the demo of this extension somewhere?
the demos / working examples are common and useful idea to see how does extension look like / work :)
"shop.ShopModule" is invalid. Make sure it points to an existing PHP file.
I could not resolve this issue,despite the explanation given above by 'danaluther'..please explain to me where should I create this module folder, I created this in the main directory of my web application and placed the extracted shop folder inside that..I have included the given code in main..but this error keeps coming!
Location of modules folder
The modules folder should be located at /protected/modules/ which means your shop should be at /protected/modules/shop/
demo
demo !!! and modules ?? in step 1 . there is no modules folder. only models folder is there.
@jayii
If the modules folders is not there, then create it under 'protected' folder, its not a big deal...
License
Why can't you license this BSB? Yii is BSD license.
Oops
No license in the package.... too bad.
License of yii-shop
Thanks for your interesting in yii-shop and the license of yii-shop.
yii-shop stays GPL, because Software should stay free. You can use it in commercial projects (what sense would a non-commercial shop make anyway ;) ), you can fork it, you can contribute to it! I see no problems with a GPLv3 license for yii-shop and all my other extensions.
database tables
how all the tables create automatically ?
i have created a database named SHOP,and made changes in config/main.php !
what else should i follow to view all tables in my database ?
installation
did you run the installer?
Looking good so far!! Nice job!
I've got products and images loaded up, also running RBAM and have User model. Wondering if you have any docs on hooking up yii-shop to existing user db?? Looks to me like the next step is to setup foreign keys in the shop_customer tbl as the email address should have already been verified in the user setup process.
Did notice that user_id is getting set if a current user is logged in to the site, but the if not, once logged in, it doesn't return to the checkout page.
Some instructions sure would be appreciated!!
Definitely a version 0.xx program
So if you really don't know the Yii framework very well, you had better wait for 1.0 to come out ...
There are a bunch of things that need to be worked on and configured.
Don't get me wrong, this is an good pre-stage module, but someone shouldn't even think about putting this into production without a major amount of rewriting and configuring.
Parse error: syntax error, unexpected ':' in...
This issue is caused by obsolete PHP version < 5.3.
Unfortunately, there are still hosting providers with PHP 5.2 installed...
To fix this:
Update PHP version OR:
In yiishop/models/Products.php, method setVariation() you'll find this:
... 'position' => @$value['position'] ?: 0, ... 'price_adjustion' => @$value['price_adjustion'] ?: 0, ...
change it to this:
... 'position' => isset ($value['position']) ? $value['position'] : 0, ... 'price_adjustion' => isset ($value['price_adjustion']) ? $value['price_adjustion'] : 0, ...
$result = ($variable) ?: 'variable is false'; trick is available only in PHP 5.3
Cheers
test
I need to test this extension, looks interesting thanks.
yii-shop_0.7rc3.tar.bz2 database schema is not updated
i just downloaded and integrated this lovely modules in YII it has updated files but not an updated database schema.. can some one tell me when i will get updated database schema.
it has all below tables in a code but not in a database schema
public $categoryTable = 'shop_category';
public $productsTable = 'shop_products'; public $orderTable = 'shop_order'; public $orderPositionTable = 'shop_order_position'; public $customerTable = 'shop_customer'; public $addressTable = 'shop_address'; public $imageTable = 'shop_image'; public $shippingMethodTable = 'shop_shipping_method'; public $paymentMethodTable = 'shop_payment_method'; public $taxTable = 'shop_tax'; public $productSpecificationTable = 'shop_product_specification'; public $productVariationTable = 'shop_product_variation';
jackcobain: database schema
afaik the schema provided in the package is up-to-date.
Could you please try the schema provided at code.google.com/p/yii-shop ?
thank you!
Two Products tables?
Why is the Products table defined twice in the InstallController.php file at lines 132 and 223?
The second table is never created because of the 'IF NOT EXISTS' clause. The second table appears necessary for order handling.
Thank you
Thank you. But you code is really bad. Do you familiar with MVC?
Have you heard that operating with models directly within the view files is not quite good?
Why you calling models in plural form?
.....
Good module. Needs retouches.
To my liking is a good module. If there's something to be added, I'd fork it and do my own, instead of blaming the creator. Thanks.
Install error
The weirds thing is I did checkout from svn and gave me this error when I try to install
The table "shop_category" for active record class "Category" cannot be found in the database.
But if I download the zip file from here it works.
does anyone know the error above?
Products Table
Two Products tables?
Why is the Products table defined twice in the InstallController.php file at lines 132 and 223?
great effort
'modules'=>array( .... 'shop' => array( 'debug' => true, 'loginUrl' => array('/user/auth'), 'currencySymbol' => '€', ),
localhost/yourapplicationname/index.php?r=shop/install/index ,
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.
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.
tablePrefix
I usually use a tablePrefix of "tbl". In this case, I had to use "shop" as this is what gets installed.
'components'=>array( ... 'db'=>array( ... 'tablePrefix' => 'shop_',
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
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
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));
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 ?
Register customer form no validation change
//CustomerController
public function actionCreate()
{ if($model = Shop::getCustomer()) { $address = $model->address; } else { $model = new Customer; $address = new Address; if(isset($_POST['ajax']) && $_POST['ajax']==='customer-form') { echo CActiveForm::validate(array($model,$address)); Yii::app()->end(); } ////////////// more code .............
/////////////////////////////////////////
-form.php
/shop/views/customer/_form.php
// change to true
'enableAjaxValidation'=>true,
// Note: add to form file:
'clientOptions'=>array('validateOnSubmit'=>true,), 'htmlOptions' => array('enctype'=>'multipart/form-data'),
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
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.
What error phamdoan?
What error?
You cannot see the table with text?
Or
You cannot render partial the view.php?
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 !!
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.
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..??
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..??
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.
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.
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.
Cannot create new or update product
When i tried to add new product it only showed this
how do we fix it? Thanks
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.
I can't make it to work
Hi,
in my protected i create folder modules and i add all youre folders and files.
in my protected folder in config/mail.php i add return array(
'modules' => array('shop' => array( 'debug' => 'true')),
in top. but when i go to http://127.0.0.1:90/eccyii/shop/install it say
Not Found
The requested URL /eccyii/shop/install was not found on this server.
URL was not found on this server
Hi Ionut2014
What program do you use on your PC?
Is it XAMPP?
If it is, when you enter in your browser in the address bar: http://127.0.0.1<br />
Do you see Welcome to XAMPP for Windows! (page)?
Response
I have wampp and in my www i hav others folders with websites .
I putt yii and modules yuurs in folder
http://127.0.0.1:90/eccyii/shop/install
eccyii in folder.
My server is ok, i have many websites here
testing the yii app
Ionut2014 wrote:
I putt yii and modules yuurs in folder http://127.0.0.1:90/eccyii/shop/install
I am a bit confused about it.
You gave me a link of your browser (http://127.0.0.1:90/eccyii/shop/install)
It is not a folder. It is a link. The folder might be: eccyii/shop/install
Let me do a simple test
Note: I think you have the folder framework somewhere (important!)Download file: yii-1.1.15.022a51.tar.gz (.zip file)
From link: http://www.yiiframework.com/download/
Unzip it into somewhere... C:\...Yii_1.1\yii-1.1.15.022a51\yii-1.1.15.022a51
Open your browser and type into the browser address window: http://127.0.0.1/helloworld/
You will get some warnings as:
Fatal error: require_once(): Failed opening required 'C:\xampp\htdocs\helloworld/../../framework/yii.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\helloworld\index.php on line 4
Open in php editor (like Eclipse) the file: index.php
require_once(dirname(__FILE__).'/../../framework/yii.php');
Yii::createWebApplication()->run();
Check is where have you put the framework folder. In my situation it is in C://
Note: this is important. You have to know the location of the framework folder.
$yii=dirname(__FILE__).'/../../../framework/yii.php';
Note: this is my directory, your directory can be different
$config=dirname(__FILE__).'/protected/config/main.php';
defined('YII_DEBUG') or define('YII_DEBUG',true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
require_once($yii);
Yii::createWebApplication($config)->run();
Open your browser and type into the browser address window:
http://127.0.0.1/helloworld/
You will get some warnings as:
Warning: require(C:\xampp\htdocs\helloworld/protected/config/main.php): failed to open stream: No such file or directory in C:\framework\base\CApplication.php on line 133
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\helloworld/protected/config/main.php' (include_path='.;C:\xampp\php\PEAR') in C:\framework\base\CApplication.php on line 133
This is the configuration file.
Create folder config. C:\xampp\htdocs\helloworld\protected\config
<?php
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'My Web Application',
);
Hello World
The test is finished.
resp
I have WAMP, in my WWW folder i installed YII from console, i can see my yii default page, i add youre code in E:\wamp\www\eccyii\protected\modules (i created modules folder)
My wamp path is: E:\wamp\www\eccyii
but i will try your method
re
i have wamp not xampp and if i add folder from demo in my www folder, in browser it say hellow world without errors. If you want to add in my htdocs i have to put in my apache folder in my version, in bin folder....
resp
Here is a video from my PC
https://vid.me/S1rf
Ionut2014 questions
Sorry Ionut2014
Can not help you more.
Looks like the yii works.
If you cannot open the shop module, check the configurations and so on...
Please read some info on this site. Plenty of help here.
Adding a variation?
I've been working with the module and overall its a good start. One question I have is this, however - I'm not clear on how to add a "variation" to a product? So I have the grid/table at the bottom of the Product Update page but I don't see a way to add a variation/row to the list? Am I misunderstanding how this part functions?
Creating a new variation table, new model, new controller and so on...
Hi Todd Anstis
I want to note that I am the same user of this product as you are. The author of this module is (I can be wrong) a German guy and after he has done this good module he is now (may be) in progress of a making a new project.
I was a bit confused at first with the labels: products variations and product specifications. As I understood, the specifications are just a labels.
Note: I don't use the variations. I don't need it. But if you do... And If I understood you correctly...
How to add a row to a variation table?
You have to create a new model, new controller, new view files and so on.
To be short, you have to use the great tool: gii (http://localhost/shop/gii) or check your direction.
Example:
Welcome to Yii Code Generator!
You may use the following generators to quickly build up your Yii application:
Controller Generator
Crud Generator
Form Generator
Model Generator
Module Generator
Widget Generator
You know how to use it:
create a new table with your rows
Example:
Model Generator
This generator generates a model class for the specified database table.
Fields with are required. Click on the highlighted fields to edit them.
Database Connection db
Table Prefix [empty]
Table Name
Model Class
Base Class CActiveRecord
Model Path application.models
When you enter table name in the Table Name row the rest should be created for you automatically.
By default the GII will place the new model file in the default directory, not under the modules directory.
Then you have to create the other file using the Crud generator.
Example:
Crud Generator
This generator generates a controller and views that implement CRUD operations for the specified data model.
Fields with * are required. Click on the highlighted fields to edit them.
Model Class *
Controller ID *
Base Controller Class * Controller
Create a few variation tables mysql table type innodb only.
Have a good time with your project.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.