coreshop / CoreShop

CoreShop - Pimcore enhanced eCommerce
http://www.coreshop.org
Other
275 stars 157 forks source link

[CoreShop2] Front-End site exemple template in PHP. #178

Closed Yivan closed 6 years ago

Yivan commented 7 years ago

Hello,

Is it planned to have the frontend site exemple in PHP, or it will be only Twig ? Having it in PHP would give more insight to make a frontend using PHP template, as documentation is light on the subject (for CoreShop 1, the website exemple is very helpfull to design the front end by giving concrete PHP exemple). Having it in PHP won't refrain people who don't want to use twig to not using CoreShop. I think having one in PHP and one in Twig would be really great.

To be honest our agency don't use Twig for now, prefering to work with PHP for template. Having only Twig frontend could really be a no-go for using CoreShop, but we love CoreShop : ) So if on the stable release Twig and PHP front end could be available it will be really a good thing!

Thanks.

dpfaffenbauer commented 7 years ago

Hi Yivan,

currently it is not planned, but I'm happy to accept PR's on this topic. Since CoreShop isn't specifically limited to Twig, its possible to copy the FrontendBundle and manually convert all Templates to PHP Engine. But since I have no time currently, I can't provide PHP Engine templates. It's also kinda difficult for me to provide two FrontendBundles with two different Engines, that would mean twice the work for me then as well.

And, don't forget that the FrontendBundle is meant as demo/example and not really as kind of a "default template", if you know what I mean. It should only help you getting along with CoreShop. So I can't really see the major benefit in having TWIG and PHP.

I'll leave this issue open anyway for people who are interested in PHP Engine as well.

Yivan commented 7 years ago

Thanks for you answer @dpfaffenbauer

It is a very sad news for us. Our team have to learn the new Pimcore5, Symfony3 and CoreShop2 for the migration. It makes a lot already to learn for them! Adding Twig on the stack (we don't use it for now on our projects) will be problematic, we prefer to stick to PHP template for now (maybe Twig later). It mean we will loose one of the precious advantage of Coreshop : having a ready front-end.

As you say it, front-end is here just for example, but it is a really valuable addition for starting project and undestand the way coreshop works. We see the front-end bundle as a boilerplate template to start project. In providing only twig, we won't be able to use CoreShop2 now i think : (( Maybe later after the team is more expert with Pimcore5/Symfony3.

I undestand perfectly it is lot of work to maintain 2 versions, but I really hope you could find a way to provide both one day. Having both will not prevent agency/people like us not using twig to not using CoreShop2 (or being reluctant because it need to re-make the front-end if not using twig).

A first side question please:

A second side question:

Thanks again for you so good work on CoreShop2 which seems really promising.

dpfaffenbauer commented 7 years ago

Learning Twig is not a big deal, it took me like a few hours and I got it.

First Question: Going with Twig was a very easy decision for me. Twig lets you separate business logic from view logic. I often did ugly stuff in views, with twig, that is gone now. And I am a big fan of clear separation. I also talked to other CoreShop/Pimcore Users, most of them are going to change to Twig anyway. Cause it's the right thing to do with Symfony.

Second Question: Well, you could mix and match PHP and Twig, should work fine. But: Since the FrontendBundle always renders twig views, you would need to overwrite all Controllers in order to "overwrite" templates from FrontendBundle.

By the way: Migrating templates from Pimcore 4 to Pimcore 5 with Twig takes me about half an our per file. I mean, it heavily depends on the complexity of each template, but its a fairly easy task to be honest. Migrating them to the PHP Engine takes you about the same effort.

I just want to say: Take a closer look at twig and I suggest you starting with it as soon as possible. CoreShop is not the only Plugin thats using it. All dachcom-digital (@solverat) plugins depend on twig, and they provide you with a whole bunch of plugins/bundles you probably need for almost every project.

TLDR: Learning Twig is not the end of the world. And you only profit in clear structuring of view logic and business logic ;)

Yivan commented 7 years ago

Thanks for your constructive answer. I agree with all your statements. Just they are more easy to apply on a solo developper than a company with many devs ; )

Yes if everybody go to Twig, we need to go too to Twig i think one day. For now we will improve our team members on Symfony, it is already a big new framework to learn and top priority for us. Twig will come in a second step later. But like you said if dachcom-digital (@solverat) plugins are stick to Twig too without PHP template alternative, all the good extension will not be usable in the time between... : ( I just hope Twig will be a selected technologies in our company and dev will be trained to it not in 2 years ; )

fashxp commented 7 years ago

Hi, just a quick comment from Pimcore's perspective on that matter. First of all: Thanks for the good job to all of you!!

In terms of rendering engines: there are good reasons to go for Twig as well as there are to go for PHP. Pimcore supports both rendering engines and wants to let the developers choose which way to go. And this choice is important for us. Therefore we would love to see generic bundles also support both as that would strengthen the whole Pimcore ecosystem.

Cheers...

dpfaffenbauer commented 6 years ago

will be closed due to not reasonable to implement

Yivan commented 6 years ago

I understand that it involves many work to provide both. I hope one day maybe we will have the choice between php/twig ; )

Could you provide at least a mecanisme to swith to PHP engine for views without having to overwrite all controllers ? (you explained in your previously answer that we need to overwrite all controllers : ( ), like a global settings for instance ?

dpfaffenbauer commented 6 years ago

Yes, seems like a reasonable thing to do. I'll reopen this case and think about a solution.

dpfaffenbauer commented 6 years ago

@Yivan PR is on its way, you can then configure which view-suffix you want to use, PHP or TWIG. But: CoreShop will not provide a default PHP Implementation!

Yivan commented 6 years ago

It is a great news and first step so we can use coreshop without twig. Thanks ! I hope somedays some PHP template will be provided.