cancel
Showing results for 
Search instead for 
Did you mean: 

Theme customisation best practice

Theme customisation best practice

Hi Guys,

 

Hope you are all well.

 

I am a front end developer by trade (specifically Wordpress, HTML, CSS & Javascript) and I am learning Magento2 currently.

 

So far I am really happy with my progress so far, specifically with command line and using SSH (something I have put off learning for a long time). My question is about best practice when editing themes.

 

So I have set myself a goal of re-creating this website https://bulkpowders.co.uk on my localhost to learn how to customise and learn magento2 correctly. My question comes with editing the HTML and CSS. 

 

I want to create some icon blocks - Now is it best practice to add a widget and then put my code in there and then display it where I want? Or should I be creating custom modules for my code elsewhere.

 

E.g on that website (bulk powers) they have some icons and text under the main navigation. Now I have got a widget set up on my local host with some test code in there - I am confident I can re-create this inside that newly set up widget but I just wanted to be sure if I am right in doing this.

 

Many thanks!
Greg

1 REPLY 1

Re: Theme customisation best practice

Hi @gregoryclayton 

 

Theme customization is crucial and has become an important part of E-store development these days with the availability of so many theme provider. To be very frank most of the theme developer has shabby unoptimized code which makes customization extremely difficult and finally we think theme on psd is much better to compare to buying code theme. However, there are few things which considered while customizing the theme or buying a new theme 

 

1) using css instead of less. Magento follow only less structure.
2)  some files adding direct sql queries, which is not feasible as per magento standard. For ex. In brand module your code is

$table_name = $this->_resource->getTableName('ves_brand_product');
$brandIds = $connection->fetchCol(" SELECT brand_id FROM ".$table_name." WHERE product_id = ".$product->getId());
3) using direct objectmanger in many files like $data = $this->_objectManager->get('Magento\Backend\Model\Session')->getFormData(true); This should be avoided
4)  files have unused/commented code which should be not there.

 

Hope this will help you to some extent . You can also check best theme code as per magento standard on https://www.magedelight.com/magento-2-themes.html  . They are bit expensive compare to other theme provider but they are developed with best magento standard and practices 

 

Regards

Kuldeep sharma