sonata-project / ecommerce Goto Github PK
View Code? Open in Web Editor NEW[Abandoned] E-Commerce solution provided by Sonata
Home Page: https://sonata-project.org
License: MIT License
[Abandoned] E-Commerce solution provided by Sonata
Home Page: https://sonata-project.org
License: MIT License
This is related to generating the Category menu in the catalog part.
Currently, when a menu has children, they are created using getCategoryTitle($category)
function of the ProductMenuBuilder class. This function is generating a menu name based on the category Title.
But this will not work well if someone is having categories with same name and same number of products in it (in my case... I had 2 subcategories with same name, with different parent categories). This is because KnpMenu finds an already existent menu element with that name and it is not generating a new menu entry but overwriting the already existent one.
This is easily fixable by creating the child menus using the categoryId as name and after that setting a label for the newly created child menu (using the getCategoryTitle($category)
function mentioned above). We only need that fancy HTML to be displayed, not to actually be used as menu identifier (menu name).
How should I tackle the problem of including Variations that have types like DateTime or another object like an Address ?
I have overridden the getVariationsChoices in the provider and set the $variationValue as a string. Though I'm not sure that this is the most elegant solution my problem now is that the request to /app_dev.php/shop/product/prod1/20/variation?sonata_product_variation_choices%... can't find the proper variation and always get a error "Sorry, the product you're looking for is unavailable."
What's the best approach in here?
Thank you
Hey,
I saw in the product bundle there's a controller to handle product by collections.
So I've added a route :
sonata_product_catalog_collection:
path: /hello/{name}/{collectionId}
defaults: { _controller: SonataProductBundle:Collection:listProducts }
But it doesnt work. seems that the controller call an method that does not exist (anymore/yet) ?
Fatal error: Call to undefined method Sonata\ProductBundle\Entity\ProductSetManager::getProductsByCollectionIdPager() in \vendor\sonata-project\ecommerce\src\ProductBundle\Controller\CollectionController.php on line 85
Method "enabledVariations" for object "Application\Sonata\ProductBundle\Entity\Travel" does not exist in SonataProductBundle:Travel:view_variations.html.twig at line 18
Hi,
i wanted to create a product with the command line but i receive the following message.
[Exception]
Please initialize a ProductBundle first in the Application directory
After having a look at the command line i see it checks for a Application/Sonata/ProductBundle in
%s/../src/Application/Sonata/ProductBundle (line 54 of GenerateProductCommand.php) while mine is as all others of SonataBundles in App/Application. Why not use the line from the config file where you can mention the class for the product and parse it to check if the folder/file exists ?
sonata_product:
class:
product: Application\Sonata\ProductBundle\Entity\Product
Exception trace:
() at D:\xampp\htdocs\dev2\keusters\vendor\sonata-project\ecommerce\src\ProductBundle\Command\GenerateProductCommand.php:58
Sonata\ProductBundle\Command\GenerateProductCommand->execute() at D:\xampp\htdocs\dev2\keusters\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:244
Symfony\Component\Console\Command\Command->run() at D:\xampp\htdocs\dev2\keusters\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:900
Symfony\Component\Console\Application->doRunCommand() at D:\xampp\htdocs\dev2\keusters\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:191
Symfony\Component\Console\Application->doRun() at D:\xampp\htdocs\dev2\keusters\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:96
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at D:\xampp\htdocs\dev2\keusters\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:121
Symfony\Component\Console\Application->run() at D:\xampp\htdocs\dev2\keusters\app\console:27
sonata:product:generate product service_id
$formMapper->add('productType', 'choice', array('choices' => array_keys($this->productPool->getProducts())))
if I understand it correctly, this is only valid in "create" mode for a new OrderElement; in "edit" mode of an existing OrderElement, it shall display the OrderElement productType of the product, which is not currently the case.
Hello
When i run "php app/console" in the sonata-sandbox,i get this error
PHP Fatal error: Declaration of Sonata\ProductBundle\Entity\BaseProduct::validateOneMainCategory() must be compatible with Sonata\Component\Product\ProductInterface::validateOneMainCategory(Symfony\Component\Validator\ExecutionContext $context) in /home/shuo/workspace/localserver/sonata/vendor/sonata-project/ecommerce/src/ProductBundle/Entity/BaseProduct.php on line 28
Ok nevermind…
The CustomerInterface should be renamed into PersonInterface and moved in a Person component. Also a PersonBundle should be created to include an entity called Person. The Customer entity will include a parameter $person that will be of Person type.
This way we can use Person for other types of data and the db will be better normalized.
For a better normalization, we can do a lot more things, like: moving phone numbers to their entity class, also creating a phone type entity, a fax entity and a fax type entity, etc.
I am using Sonata eCommerce in a project I am working on.
I was trying to add new fields to the basket entity, but for some reason they were not persisted across session. So I was trying to solve this by setting the Basket to work as entity (saving basket to Database, not in session). This way I found out that in the deliveryAction and paymentAction (for some reason I cannot really explain) we have the basket cloned right from beginning. This made the EntityManager trying to save a new basket record and raised a unique constraint error every time I was trying to process the basket on one of the steps mentioned above (there may be ONLY one basket per customer).
I solved it by removing the "clone" code from here and here.
Steps to reproduce:
Hi
I am receiveing
Entity 'Application\Sonata\ProductBundle\Entity\Product' has to be part of
the discriminator map of 'Application\Sonata\ProductBundle\Entity\Product'
to be properly mapped in the inheritance hierarchy. Alternatively you can m
ake 'Application\Sonata\ProductBundle\Entity\Product' an abstract class to
avoid this exception from occurring.
Yes, I created Product Prototype and Yes, it extends Product class
Here is my config
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: @ApplicationSonataProductBundle/Resources/config/product.yml }
framework:
#esi: ~
#translator: { fallback: "%locale%" }
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
templating:
engines: ['twig']
#assets_version: SomeVersionScheme
default_locale: "%locale%"
trusted_hosts: ~
trusted_proxies: ~
session:
# handler_id set to null will use default session handler from php.ini
handler_id: ~
fragments: ~
http_method_override: true
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
# Assetic Configuration
assetic:
debug: "%kernel.debug%"
use_controller: false
bundles: [ ]
#java: /usr/bin/java
filters:
cssrewrite: ~
#closure:
# jar: "%kernel.root_dir%/Resources/java/compiler.jar"
#yui_css:
# jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
# Doctrine Configuration
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
# if using pdo_sqlite as your database driver, add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# path: "%database_path%"
types:
json: Sonata\Doctrine\Types\JsonType
currency: Sonata\Component\Currency\CurrencyDoctrineType
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
mappings:
SonataMediaBundle: ~
ApplicationSonataProductBundle: ~
SonataProductBundle: ~
# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
fos_user:
db_driver: orm
firewall_name: main
user_class: Application\Sonata\UserBundle\Entity\User
group:
group_class: Application\Sonata\UserBundle\Entity\Group
group_manager: sonata.user.orm.group_manager
sonata_block:
default_contexts: [cms]
blocks:
# Enable the SonataAdminBundle block
sonata.admin.block.admin_list:
contexts: [admin]
sonata_user:
security_acl: true
manager_type: orm
profile:
menu:
- { route: 'sonata_user_profile_edit', label: 'link_edit_profile', domain: 'SonataUserBundle'}
- { route: 'sonata_user_profile_edit_authentication', label: 'link_edit_authentication', domain: 'SonataUserBundle'}
- { route: 'sonata_order_index', label: 'order_list', domain: 'SonataOrderBundle'}
sonata_media:
default_context: default
db_driver: doctrine_orm
contexts:
default:
providers:
- sonata.media.provider.image
- sonata.media.provider.file
formats:
small: { width: 100 , quality: 70}
big: { width: 500 , quality: 70}
cdn:
server:
path: /uploads/media
filesystem:
local:
directory: %kernel.root_dir%/../web/uploads/media
create: false
sonata_price:
currency: USD
sonata_delivery:
services:
free_address_required:
name: Free
enabled: true
priority: 1
code: free
sonata_payment:
services:
pass:
name: Pass
enabled: true
code: pass
browser: sonata.payment.browser.curl
transformers:
basket: sonata.payment.transformer.basket
order: sonata.payment.transformer.order
options:
shop_secret_key: assdsds
url_callback: sonata_payment_callback
url_return_ko: sonata_payment_error
url_return_ok: sonata_payment_confirmation
# service which find the correct payment methods for a basket
selector: sonata.payment.selector.simple
# service which generate the correct order and invoice number
generator: sonata.payment.generator.mysql
transformers:
order: sonata.payment.transformer.order
basket: sonata.payment.transformer.basket
sonata_product:
products:
sonata.shop.product.crewneck:
provider: sonata.shop.product.crewneck.type
manager: sonata.shop.product.crewneck.manager
class:
product: Application\Sonata\ProductBundle\Entity\Product
package: Application\Sonata\ProductBundle\Entity\Package
product_category: Application\Sonata\ProductBundle\Entity\ProductCategory
product_collection: Application\Sonata\ProductBundle\Entity\ProductCollection
category: Application\Sonata\ClassificationBundle\Entity\Category
collection: Application\Sonata\ClassificationBundle\Entity\Collection
delivery: Application\Sonata\ProductBundle\Entity\Delivery
gallery: Application\Sonata\MediaBundle\Entity\Gallery
When I create a Product type through command line
php app/console sonata:product:generate Bowl sonata.ecommerce_demo.product.bowl
And configured all services and go admin panel and click "sonata.ecommerce_demo.product.bowl" then show me error:
Could not load type "sonata_formatter_type"
Why ?
I want to add product image to order Element, so i create relation oneToOne betwen orderElement and Product and also update createOrderElement method in my productProvider class.
Everything works fine, but when I placed order i recive SQL error that there is duplicate entry:
...Integrity constraint violation: 1062 Duplicate entry '2' for key...
Could sombody give me advice how could I solve this problem or mayby is bether method to implement productImage to order?
Hi,
I would like to check my fix so I cloned ecommerce repo added fix and want to update my composer.json to use it.
"repositories":
[
{
"type": "git",
"url": "https://github.com/piotr-galas/ecommerce"
}
],
"require": {
// what I had before => "sonata-project/ecommerce": "~2.3@dev"
"ecommerce": "dev-master"
}
How should I set up composer.json?
I did it like above but I get
$> composer.phar update -o
Warning: This development build of composer is over 30 days old. It is recommended to update it by running "/usr/local/bin/composer.phar self-update" to get the latest version.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package ecommerce could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Steps to reproduce:
We must add the product variation with the smallest price referenced. In this example, we have: travel-japan-tour-5
NOTE - There is a mistake in the total TVA. Seems to be related with this issue ??
Steps to reproduce:
PS - Screenshot attached for the last step
All configuration successfully done. When I go command line and run
app/console doctrine:schema:update --force
Then Show me error:
[Doctrine\DBAL\DBALException]
Unknown column type "currency" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::add
Type(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypeMap(). If this error occurs during datab
ase introspection then you might have forgot to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoc
trineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a
problem with the cache or forgot some mapping information.
Hello,
When i try to add a new product from sonata admin i choose my product and i've an error during template rendering :
Serialization of ´Closure' is not allowed.
Hello,
When i add a product in sonata admin i get this
Catchable Fatal Error: Argument 1 passed to Sonata\ProductBundle\Entity\BaseProduct::validateOneMainCategory() must be an instance of Symfony\Component\Validator\ExecutionContext, instance of Symfony\Component\Validator\Context\LegacyExecutionContext given in /media/mehdi/Data1/work/phpwork/cookbook/vendor/sonata-project/ecommerce/src/ProductBundle/Entity/BaseProduct.php line 949
Updated develop branch and have this error.
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
The service "sonata.delivery.pool" has a dependency on a non-existent service "".
http://{host}/admin/sonata/product/product/list
An exception occurred while executing 'SELECT count(DISTINCT p0_.id) AS sclr0 FROM product__product p0_ LEFT JOIN product__product_category p1_ ON p0_.id = p1_.product_id LEFT JOIN classification__category c2_ ON p1_.category_id = c2_.id LEFT JOIN product__product_collection p3_ ON p0_.id = p3_.product_id LEFT JOIN classification__collection c4_ ON p3_.collection_id = c4_.id WHERE p0_.product_type IN ()':
First of all, thanks for your great job.
I try to install sonata ecommerce with your last version following your tuto but when I want to generate application entities, I must edit config.yml with minimum information :
sonata_delivery:
services:
sonata_payment:
services:
transformers:
Now I've got this error : The service "sonata.customer.admin.customer" has a dependency on a non-existent service "
sonata.price.currency.detector".
I don't know what is wrong.
Is it possible to move the add_product_form.html.twig and add_product_poppin.html.twig from the [BasketBundle] to the [ProductBundle] so as to make them easily extendable on a by product base, like the form_basket_element.html.twig and final_review_basket_element.html.twig ? Thanks.
Hi,
As we keep improving our work, we are working on a new version of the tutorial provided with the e-commerce bundles.
Many things can be done, however, we propose these changes so far:
Feel free to propose new tasks, insights and/or give us feedback.
Thx
Hi
I want to know more about the possibility of developing Discount cart for e-commerce project. If it possible :) Maybe I can be useful. Do you already have any idea how this cart can be implemented?
Thanks :)
Now, I have this error after implement my application entities and update my config file following your different configurations for each bundles.
Unrecognized options "builder, factory, loader, class, basket, shipping, pa
yment" under "doctrine"
Do you have any idea what is wrong ?
Steps to reproduce:
PS - Screenshot attached for the last step
First ! Many thanks for your great work...!
When I run the easy-extends:generate commands as show in doc http://sonata-project.org/bundles/ecommerce/master/doc/reference/installation.html
show me error in file SonataDeliveryExtension.php line 49
ContextErrorException: Notice: Undefined index: services in /var/www/xyz.com/vendor/sonata-project/ecommerce/src/Sonata/DeliveryBundle/DependencyInjection/SonataDeliveryExtension.php line 49
And when I comment SonataDeliveryBundle in AppKernal.php file then this error show me in file SonataPaymentExtension.php.
ContextErrorException: Notice: Undefined index: services in /var/www/xyz.com/vendor/sonata-project/ecommerce/src/Sonata/PaymentBundle/DependencyInjection/SonataPaymentExtension.php line 52
And again I comment SonataPaymentBundle in AppKernal.php file then this error show me:
ServiceNotFoundException: The service "sonata.customer.admin.customer" has a dependency on a non-existent service "sonata.price.currency.detector".
Again commented SonataCustomerBundle then:
ParameterNotFoundException: The service "sonata.basket.form.type.address" has a dependency on a non-existent parameter "sonata.customer.address.class". Did you mean this: "sonata.customer.selector.class"?
Again commented SonataBasketBundle then:
The service "sonata.product.block.recent_products" has a dependency on a non-existent service "sonata.price.currency.detector".
then commented SonataProductBundle:
ServiceNotFoundException: The service "sonata.order.block.recent_orders" has a dependency on a non-existent service "sonata.customer.manager"
then commented SonataOrderBundle:
ServiceNotFoundException: The service "sonata.invoice.admin.invoice" has a dependency on a non-existent service "sonata.price.currency.detector"
And last commented SonataInvoiceBundle.
And No error ;)
Entity 'Application\Sonata\ProductBundle\Entity\Product' has to be part of the discriminator map of 'Application\Sonata\ProductBundle\Entity\Product' to be properly mapped in the inheritance hierarchy. Alternatively you can make 'Application\Sonata\ProductBundle\Entity\Product' an abstract class to avoid this exception from occurring.
I am using Sonata eCommerce bundle and I am storing the basket in DB.
This way I have found out that the isPriceIncludingVat
BasketElement field is NOT stored in DB, thus messing up Basket calculation (it is loaded as false
for every BasketElement).
Hi
I'm reading the docs and I can't really understand if it's possible to create multiple product variations and with dependencies between them.
For example
shoe:
-- variation color:
red:
-- variation size:
37
38
39
blue:
-- variation size:
40
41
.....
Is there a way to accomplish this at the moment ?
thank you
Hi Guys
First.. Thanx for your great work! We're following this project since several time and we are really happy and excited about the demo.
Theses days we are planning to use the most of Sonata Project for our future administration.
My question is about the Ecommerce part :
Is it possible to know more about the releases planning ?
Thank you very much.
Fatal error: Cannot use Sonata\Component\Delivery\Pool as Pool because the name is already in use in /vendor/sonata-project/ecommerce/src/Sonata/Component/Transformer/InvoiceTransformer.php on line 4
Hello,
I have installed Classification bundle and also install its depends bundle, I have configured all steps from http://sonata-project.org/bundles/classification/master/doc/index.html
I created catalog:
-Root
--category1(parent root)
---category2(parent category1)
--category3(parent root)
If delete subcategory the entire directory will be removed.
how to fix it ?
I follow this doc : http://sonata-project.org/bundles/ecommerce/master/doc/reference/installation.html
As per manual part when I Run the easy-extends:generate commands then show me error 👍
ContextErrorException: Notice: Undefined index: seo in /var/www/xyz.com/vendor/sonata-project/ecommerce/src/Sonata/ProductBundle/DependencyInjection/SonataProductExtension.php line 317
Useful for quick change product variation.
I have 80% now.
W8 for issue #258
An exception has been thrown during the rendering of a template ("[ERROR 94] Validation failed: no DTD found ! (in n/a - line 2, column 21)
[ERROR 1877] Element '{urn:oasis:names:tc:xliff:document:1.2}trans-unit': Duplicate key-sequence ['sonata.invoice.references.date'] in key identity-constraint '{urn:oasis:names:tc:xliff:document:1.2}
duplicate entry "sonata.invoice.references.date" en vendor/sonata-project/ecommerce/src/Sonata/InvoiceBundle/Resources/translations/SonataInvoiceBundle.en.xliff and sonata.invoice.references.invoice in vendor/sonata-project/ecommerce/src/Sonata/InvoiceBundle/Resources/translations/SonataInvoiceBundle.fr.xliff
Steps to reproduce:
PS - Screenshot attached for the last step
I am author of payum lib https://github.com/payum and is there any change we can work togherher? I mean you can use payum as base for your payments.
P.S. Sylius does this way and if you do too everybody would benefit
When I update my E-commerce Bundle then Category.xml file is missing Product Bundle.
As you mention doc routing.yml file
sonata_category:
resource: @SonataProductBundle/Resources/config/routing/category.xml
prefix: /shop/category
And dev branch not exit category.xml
Existence another file catalog.xml
How I can fixed this ?
I have setup eComerce bundle with Paypal integration and there is an issue with the IPN integration.
When Paypal makes the IPN call, we need to make a HTTP POST call back to Paypal to assure validity (as it does say here).
This is implemented (or it should be) in current Paypal class. The code is pretty much there... only problem is that ->getWebConnectorProvider() is not working at all (it throws an error).
I managed to fix it by overwriting the Paypal class and the sendConfirmationReceipt() method to use plain CURL.
I had another issue in same class (see this).
I could add a PR to fix them both.
Hi,
A customer is actually linked to a FOSUserBundle user (FOS\UserBundle\Model\UserInterface
) as specified in the CustomerInterface (https://github.com/sonata-project/ecommerce/blob/master/src/Component/Customer/CustomerInterface.php).
As CustomerInterface
is also used in a lot of classes, projects that does not use FOSUserBundle (such eZPublish for instance) have to redefine a lot of things just to bypass this issue.
What about using the Symfony\Component\Security\Core\User\UserInterface
instead to do not limit Sonata ecommerce using FOSUserBundle by default?
In my project I sell magazines .
I want to add Subscription in our Ecommerce system like: I want to buy 1 year magazine Subscription Packages or 3 , 2 Months Subscription Packages.
How I can add this in Sonata Ecommerce Bundle ?
or
If I used Cart Button on Subscription center It is possible direct send to cart ?
Any suggestion will be highly appreciated !!!
When you register just after checkout you are redirected to homepage instead of address step.
When register from elsewhere in the website, you should come back to the referer (imo)
$collector->addIndex($config['class']['order_element'], 'status', array(
'status'
));
$collector->addIndex($config['class']['order'], 'status', array(
'status'
));
In customer.php Class (Application/Sonata/CustomerBundle/Entity/Customer) which is extends base.
I want user field in Customer Class mapped to other User Entity Class Which one already registered as name Xyz/UserBundle/Entity/User.
But If I change relation show me error. How I can change Customer Class relation to User Class?
I do not want to create and use Application/Sonata/UserBundle.
Thanks in advance !!!
Any Suggestion will be highly appreciated..!!
When I write route in routing,yml as doc:
sonata_order:
resource: @SonataOrderBundle/Resources/config/routing/order.xml
prefix: /shop/user/invoice
sonata_product:
resource: @SonataProductBundle/Resources/config/routing/product.xml
prefix: /shop/product
sonata_category:
resource: @SonataProductBundle/Resources/config/routing/category.xml
prefix: /shop/category
sonata_payment:
resource: @SonataPaymentBundle/Resources/config/routing/payment.xml
prefix: /shop/payment
sonata_invoice:
resource: @SonataInvoiceBundle/Resources/config/routing/invoice.xml
prefix: /shop/user/invoice
Only /shop/category url working and others url not working.
I do not know why ?
All configuration is right as per doc.
Any Suggestion will be highly appreciated..!!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.