Start a new topic
Answered

Developing a custom store

Hi guys,


How would you suggest to go about creating a new store? The existing storefront doesn't suit the requirements - a lot of customization should be made. I'd also like to use the standard ASP.NET MVC framework with Razor Engine. What puzzles me is:


- Where do I keep the business logic?

- What should I bear in mind while implementing a custom storefront?

- Is there a way to still add liquid/razor templates via the backoffice virto commerce manager app?


Best Answer

Hi, maybe not worth it hot :) And try to modify an existing implementation to fit your requirements :) Interesting to hear this requirements, and we can will give you more concrete suggestions or even implement it in our storefront.


Current storefront used two view engines - liquid and default razor. To start using razor views you just need to create razor views in standard Views folders. Inside you razor views you will get access to main WorkContext model and you can preserve all storefront controllers and middleware as it.


Better place for custom business logic is a module hosted in platform and exposed own functionality through API. Storefront should contains only logic which related to presentation.


Current storefront implementation contains a lot of already done features and nuances such as (SEO, multi-store and language routing, working with currencies and localization, build-in checkout) for new storefront you should be care about all its even if you are of them do not know yet. I would strongly not recommended to start from scratch, better change exist storefront implementation remove unused code or add self but it anyway will be faster then writing new storefront from scratch. Maybe better spend some time to understanding how it works but it will save huge time in future (Current storefront not so bad :) )


If you don't want use Liquid you could remove VirtoCommerce.LiquidThemeEngine project from solution and write all views in razor. But for this case to persist availability to edit Themes in CMS module you views should be stored at the same place where stored current liquid themes. (cms-content folder).





Answer

Hi, maybe not worth it hot :) And try to modify an existing implementation to fit your requirements :) Interesting to hear this requirements, and we can will give you more concrete suggestions or even implement it in our storefront.


Current storefront used two view engines - liquid and default razor. To start using razor views you just need to create razor views in standard Views folders. Inside you razor views you will get access to main WorkContext model and you can preserve all storefront controllers and middleware as it.


Better place for custom business logic is a module hosted in platform and exposed own functionality through API. Storefront should contains only logic which related to presentation.


Current storefront implementation contains a lot of already done features and nuances such as (SEO, multi-store and language routing, working with currencies and localization, build-in checkout) for new storefront you should be care about all its even if you are of them do not know yet. I would strongly not recommended to start from scratch, better change exist storefront implementation remove unused code or add self but it anyway will be faster then writing new storefront from scratch. Maybe better spend some time to understanding how it works but it will save huge time in future (Current storefront not so bad :) )


If you don't want use Liquid you could remove VirtoCommerce.LiquidThemeEngine project from solution and write all views in razor. But for this case to persist availability to edit Themes in CMS module you views should be stored at the same place where stored current liquid themes. (cms-content folder).





1 person likes this

Hi Eugeny, thanks for the thoughtful answer. If using Razor views is supported, that definitely makes things better - one of the things I'd like to have is the familiar development tooling with syntax highlighting, compile-time checks and Resharper :) 


Are there any areas where liquid view engine wins over razor (except for compatibility with Shopify themes) ?

We'd also like to implement some parts (like search/filtering) in Angular2, complete with auto-suggest and 'did you mean?' - style suggestions. Is that a feasible thing to do when using the liquid viewengine? I've read that it may be tough to do that in native Shopify themes (see e.g. https://ecommerce.shopify.com/c/ecommerce-design/t/angularjs-and-shopify-206974), is that the case here too?


Some of the other custom features we're looking to implement are:


- returns management - we'd like the customer to be able to initiate returns from his profile

- paid membership plans - where a customer can upgrade to get premium services





We use  angular for next storefront functionality:

  • Full info products loading such as Prices, Promotions, Taxes etc. Because we use full page caching therefore we need to load fresh information by ajax calls.
  • Current customer information 
  • Shopping cart widget and management view
  • Checkout
You may see how it done in exist default theme: https://github.com/VirtoCommerce/vc-storefront/tree/master/VirtoCommerce.Storefront/App_Data/Themes/default/assets/js

To preventing  conflict Liquid and Angular syntax we use special liquid tag  raw. Or using ng-bind Angular directive instead of {{ exp }}.

 

{% raw %}{{ selectedVariation.primaryImage.url }}{% endraw %}


  RMA (Return Merchandise Authorization) functionality until not implemented in VC Platform but if you have some  requirements you may  create issue in github and describe  there. https://github.com/VirtoCommerce/vc-platform/issues

We currently work on Subscription module I think it may be related to you requested "paid membership plans" feature. 


Login or Signup to post a comment