Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Content Templates Manager


hava.ge

Recommended Posts

This contribution allows you to create html templates where you insert names of the product fields, instead of inserting values of the product fields. Content Templates Manager finds field names in the html of the template and replaces them by corresponding values of the product.
This allows you to edit fields values of each product on the product administration page in the traditional manner, like you are editing product name, product description etc., instead of searching product data in the html code and pasting there a corresponding values of each product , manually.

As a result, you will have dynamic content on the page. You can change html code of the Template when you want and how you want. You can create different Templates for the different groups and types of the product. You will not have to edit php script, or edit each product description for changing html of each product. You will change the Template in one place only. All field values of the product will find their place in the Html code automatically.
Content Templates Manager will do this.

You will be able to use any existing fields of the product, or add new fields and use them. You will be able to repeat fields in the html of the template how many times you want and place them where you want in the html. Having done this in the template in one place, changes will effect in all products which are linked to this template.

This contribution allows you
- to create Html templates like the tables, multipage tabs, specification multilayer tabs, beautiful blocks with products data - attributes, specifications, description, etc. After changing template, or creating new template you will not have to edit each product description to make changes there. You will change only template, changes will effect every product which are linked to this template
- it allows you to create additional fields of the products, associated with a template or with a several templates, then Content Templates Manager automatically inserts fields values in the Html markup of the template.
- allows you to link the product, or group of the products with the template and display the Template on the page.
- to create, edit, copy, remove template fields, which actually becomes a field of each product, if product is linked to the template.

 

A little more about this:
For instance, we have product some page like this:

Let say, the text is the same for the group of the products, but there are field values in the text (I put them in the quotes) which are different for each product.
let say also, there are about a thousand of product, which have this text saved in their description field, but with the corresponding to the product values in the text.
Could you imagine what happens if we decide to change this text for this group of products? We will have to change the description fields values all of the thousand products, in order to change values in the text and replace old saved text with a new text.
What would be, if we are using the Content Templates Manager, then we do not have to touch the products fields in general. We will need to change only the Template where we have saved the text, we will change it in one place and all the fields will find their place in the changed text. Changes will take effect for all products that are linked to the text template.

"Lorem ipsum dolor sit amet, "2014-March" consectetur adipiscing elit,
sed "9.4 mm" do "146.4mm" eiusmod tempor incididunt "width : 5.76" ut labore et
dolore magna aliqua. Ut "1920 pixels" enim ad "32 GB" minim veniam, quis nostrud
exercitation ullamco "5 MP" laboris nisi ut aliquip ex ea commodo "8Kw" consequat. Duis aute
irure dolor "5.7 px" in reprehenderit in voluptate "0.48 X 0.56" velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur "12.3 M2" sint occaecat cupidatat non proident."

Another example: Let say we have a large table for products specification, with a large number of rows and cells for each product.
Tables looks quite well on the page, but it is very difficult to search for the data, that are corresponding to the product, to fill or edit them in the Html code of the table.

"<table width="100%" style="color:#000;border:1px solid #83addb;background-color:#fff;" align="center" cellpadding="4" cellspacing="1">
<tr style="background-color:#d2e8ff;"> <td style="text-align:center;" width="36%">8.4 Kw</td><td style="text-align: center;" width="22%">800 px</td></tr>
<tr> <td style="text-align: center;">44 mm</td> <td style="text-align: center;">32 GB</td></tr>
<tr> <td style="text-align: center;">freq</td><td style="text-align: center;">400</td></tr>
<tr> <td style="text-align: center;">band</td><td style="text-align: center;">56.7</td></tr>
<tr> <td style="text-align: center;">92</td><td style="text-align: center;">24</td></tr>"

Can you see where the data is and where Html is in this example code of the table?- Yes, you can, but it is very hard to work with this.
Is it easy populating product data in this code?

 

This contribution can do this job very easy.

 

In the other words,

  • - You will be able to create and add any amount of additional fields to the products, by creating fields in the templates and linking products to this templates.
  • - These fields are easy to edit or fill, because they are visible for editing in the product administration panel, displayed normally, in the human friendly form.
  • - Then contribution automatically uses your entered fields values and inserts them to the appropriate place on the products page.
  • - The insertion of the fields values in the Templates will be done dynamically, before the page will be shown, content are not stored statically.
  • - This makes Content Templates Manager flexible and allows you to modify existing templates appearance and all changes will be applied to all related products without worrying about to iterate through each product and change their markup.
  • - There is an "empty fields" control ability, you have opportunity to show products empty fields as empty, or do not show some part of the Html markup in the template (for example, not show table row), if corresponding product field value is empty.
  • - You can use in your templates already existing product fields (like products name, products description, price etc.) contribution automatically inserts them where you specify in the template, on the page.
  • - You can repeat the same field in any place in the same template.
  • - You are able to share fields between the templates, and editing the field value in one place, will have an effect in all templates, where this shared field was copied.
  • - You are able to copy, duplicate, edit, delete fields.
  • - Fields are multilanguage, or you are able set it to have one value for all languages that you use.
  • - You are able to create, edit, save, delete Templates Html code from the administration panel of the templates.
  • - You are able to add css styles to the template, edit and save style from the administration panel of the templates.
  • - You can add simple java script to the template, edit and save script from the administration panel of the templates.
  • - ... and tou are able to do many other things from the administration panel of the templates.

 

Compatibility:

I'm using this contribution on the osCommerce v2.3
Other versions not tested yet. But should work in many other versions, because the contribution do not changes any other tables in the database and uses only own tables, and the contribution uses very few from the functions of the core script.

My addons:

Content Templates Manager :  http://addons.oscommerce.com/info/9288

Admin side horizontal no javascript css menu: http://addons.oscommerce.com/info/8830

osCommerce Pagination using FOUND_ROWS: http://addons.oscommerce.com/info/9378

 

 

 

 

Link to comment
Share on other sites

Download is available here: http://addons.oscommerce.com/info/9288

 

See more details more details in the download package.

Edited by burt

My addons:

Content Templates Manager :  http://addons.oscommerce.com/info/9288

Admin side horizontal no javascript css menu: http://addons.oscommerce.com/info/8830

osCommerce Pagination using FOUND_ROWS: http://addons.oscommerce.com/info/9378

 

 

 

 

Link to comment
Share on other sites

  • 6 months later...

I use osCommerce 2.3.4 Bootstrap Gold, PHP 5.4.

I can not save the template file.
I'm creating a template, click Save and exit, but the template file is not saved.
At one table the database template file is saved?

Thank you!

No outside url's in signatures allowed - thanks

Link to comment
Share on other sites

I understand.
Template files are stored in folder catalog/includes/modules/content_templates.
However, the instructions did not say that tedious to create a folder content_templates.
This is a serious problem to understand.
You need to add it in the guide.

This is a very useful addition.

Thank you very much for this addition!

No outside url's in signatures allowed - thanks

Link to comment
Share on other sites

  • 1 month later...

Hi spidometrs,

All about this is in the installation manual.

There is an empty folder "content_templates" in the package catalog/includes/modules/
that should be uploaded to the server.
 

post-322443-0-13656900-1445330574_thumb.jpg

My addons:

Content Templates Manager :  http://addons.oscommerce.com/info/9288

Admin side horizontal no javascript css menu: http://addons.oscommerce.com/info/8830

osCommerce Pagination using FOUND_ROWS: http://addons.oscommerce.com/info/9378

 

 

 

 

Link to comment
Share on other sites

  • 3 months later...

Hi!

 

Thank you for the contribution.  I installed Content Templates Manager, and I read the instructions.  But I still do not understand how to do what I need.

 

I have many similar products that require very similar text for all of them.  Hence, I am interested in making the text a template.  However, I support multiple languages, and the common text must be translated into every language.  So I need a template that can differ per language.  I do not see how Content Templates Manager supports this.  Is this possible?

 

Thank you,

 

- Igor

Link to comment
Share on other sites

I've modified the code to support my use.  
 
catalog\includes\classes\content_templates.class.php:
 

// * - load template file
public static function load_template($tid, $languages_id = null) {
  if(isset($languages_id)) {
    $file = self::templates_path() . 'template-' . (int)$tid . '-' . $languages_id .'.php';
    if(file_exists($file)) return file_get_contents($file);
  }
  $file = self::templates_path() . 'template-' . (int)$tid . '.php';
  return (file_exists($file) ? file_get_contents($file) : '');
} 

Also, change

$content = $this->template_content($this->load_template($this->templates[$templates_id]['templates_id']), $templatefields_values, $data);

to

$content = $this->template_content($this->load_template($this->templates[$templates_id]['templates_id'], $languages_id), $templatefields_values, $data);
			}

I did not modify the admin interface, though.  (I just put files in the appropriate directory with the right name).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...