Jump to content

How to change themes without losing everything.


Recommended Posts

Hi everyone 👋 ,

I am a brand new user to this platform and Prestashop.

This company hired me to do some stuff and so far it was fine since it was all client related, whatever. 

So the problem is, the current theme is not to the taste of my bosses anymore and they would like to change it!

My question is : can I change the theme without losing everything (products, modules...) or should i do like a parent/child theme. If i do the second option can i check in real time the changes that I'm doing on it. 

I don't know if my question was clear, if you do happen to have more question about my problem please feel free to do so and help me :D.

- Arthur 

  • Confused 1
Link to comment
Share on other sites

Hi Arthur

Welcome to the forum and to PrestaShop. 

Nice to see you got hired even you are new to PrestaShop.

About theme, do your bosses know how new theme should look like? Some requirements, or design ready?

 

But in general, you will not loose data, so products, categories and most of modules will be there. New theme, in most cases come with lot of modules that are just part of theme, so you might get some of old theme modules changed/removed. You should backup and test, on some developer server. Parent/child theme is just in case you make slight changes to theme.

 

 

Link to comment
Share on other sites

@ArthurA

From which version of PrestaShop you are trying to update .  If you are using PrestaShop classic theme and PrestaShop native module and your other new theme use PrestaShop native module same position then your content may looks same. What razaro said is right. PrestaShop core product, etc will same. but custom module content may be not looks good if they are overwrite from theme.

 

Best way to modification theme using child theme.

 

Thank you

Link to comment
Share on other sites

Hi to all,

I would like to expand the question from ArthurA.

Here we have a documentation about child-things : https://devdocs.prestashop.com/1.7/themes/reference/template-inheritance/parent-child-feature/

But it is without examples.

I did understand, when I copy this: templates/catalog/listing/category.tpl, the Presta will use "only" the code inside category.tpl.

The rest of the documentation is not clear.

If I like to extend the "category template" (the text before talks about category template) I have to extend it with:
{extends file='catalog/listing/category.tpl'}

Why there is instead: {extends file='catalog/listing/product-list.tpl'} ?

Later in the text we find this: {extends file='parent:catalog/listing/category.tpl'}

and "and define just the block you need".

What is the meaning of "and define just the block you need".

For example: in the File category.tpl is nothing but the string HALLO WORLD,

where on the Page I will find this "HALLO WORLD" later?

Is it before the the original - code in the category.tpl or after?

The content of the category-File (Classic Theme) on my server is:"

{extends file='catalog/listing/product-list.tpl'}

{block name='product_list_header'}
    {include file='catalog/_partials/category-header.tpl' listing=$listing category=$category}
{/block}"

 

Ok, now I like a "HALLO WORLD" after the first closing }

I would copy the category.tpl - File to my Child and there I would put the String like:

{extends file='catalog/listing/product-list.tpl'}HALLO WORLD

{block name='product_list_header'}
    {include file='catalog/_partials/category-header.tpl' listing=$listing category=$category}
{/block}"

..

How I can extend the category.tpl in the same way and not copy the category.tpl?

I need to "say the code" where I want to put the "HALLO WORLD" - String.

Did I misunderstood something?

Thank you and greetings
Daniel

 

 

 

Edited by danielsaar (see edit history)
Link to comment
Share on other sites

Hi @danielsaar

If I am not mistaken all code outside of block tag will be disregard.

So think you would need something like 

{extends file='catalog/listing/product-list.tpl'}

{block name='new_hello_world_block'}
HALLO WORLD
{/block}

{block name='product_list_header'}
    {include file='catalog/_partials/category-header.tpl' listing=$listing category=$category}
{/block}

 

For documentation, it offers two ways, like titles says redefining whole template( that is code above). That way you can order blocks way you want. And other is extending same template with code like this maybe

{extends file='parent:catalog/listing/category.tpl'}

{block name='product_list_header'}
	HALLO WORLD
    {include file='catalog/_partials/category-header.tpl' listing=$listing category=$category}
{/block}

or also this may work but would add block after all other blocks in template

{extends file='parent:catalog/listing/category.tpl'}

{block name='new_hello_world_block'}
HALLO WORLD
{/block}

 

This is all not tested but you can try and play with it.

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...