Jump to content

Images where Featured is


Recommended Posts

  • 2 weeks later...

Hi there.

Thanks for your reply.

Took me ages to get Smarty working, (I know, its really easy once I understood the logic!) but I'm having a problem trying to understand the theory of all this.

So, to use Smarty, you have to have a PHP file and a Template file (.tpl).

So if I wanted to amend the Cubecart file "box.sale_items.php" and how this displays from within the shop, do I define how Smarty works with this file ? Do I need to amend this php file (box.sale_items.php) so that Smarty can read it, and do I have to make a template file for this php file (If needed) for Smarty as well ?

I'm sure this is really easy to work with once I can get my head around the principle lol.

Thanks in advance

 

Link to comment
Share on other sites

Smarty will use whatever source you tell it to use: typically a text file (can be named anything, including any sort of filename extension, if any), a variable containing a string, the return from a database query, a couple of other types of sources.

I have no insight as to why CC5/6 chose .php as the filename suffix for the skin templates. (CC3/4 used .tpl, and some templates in the CC5/6 extension modules also use .tpl). Again, it does not matter -- but keep in mind, the core code expects the skin template filenames to be what they are.

The core code is responsible for fetching the specific details about whatever is being displayed. For the Sale Items sidebox, the core code collects the details of X-number of products and assembles them into an array. This array is then assigned to a Smarty variable. Smarty, then, when rendering the template's {foreach} command, will replace the variable's parts with the respective values.

To determine what data has been provided to Smarty for populating templates, edit the template by adding {debug} to the end of the template. Smarty will then open a popup containing all that data.

From this popup, we can determine if details about the products contain links to their images. If not, we will need to edit the core code to add that data. Then, we will be adding the necessary HTML to the template to show the images.

 

Link to comment
Share on other sites

Thanks for the reply, but you have just really confused me more, lol

I think I understand what you said above, but none of what you said has really helped.

My problem is, I have a .PHP file, and someone said that if I used Smarty, that means I could change the way things are displayed easier, by only requiring knowledge of HTML and CSS. How do I use Smarty to access a .PHP file in order to change, and view my changes ? I am under the impression that for me to do this, is not easy. Personally I can't see Smarty is any easier than me manually viewing the code in Firefox and making changes to the .CSS and, or the .PHP files ?

Or am I missing something ?

Regards

 

Link to comment
Share on other sites

"I have a .PHP file."

Please let us know what the PHP file is actually for. Is it a CubeCart skin template file, or PHP code to run a program?

"If I used Smarty, that means I could change the way things are displayed easier."

"Smarty" is not used to make changes to templates (or CSS, javascript, etc). Smarty is not an editor.

One would use a programmer's text editor to make changes to the HTML code in the template files that Smarty will use.

 

 

Link to comment
Share on other sites

So Smarty will not help me to easily manipulate template files, CSS, etc to easily change the way Cubecart looks ?

I take it the version I use does NOT use template (.tpl) files ?

So this link is no use to me ? Create custom skins and templates ?

So apart from using Firefox and the "Inspect element" there is no easy way to manipulate how things are displayed ?

My final question then, is where do I insert "Short description" so that I can use it to be displayed under the cart buy button, which makes it to the right of the picture displayed on the product page ? I presume the .PHP file for this is "content.product.php" ?

Kind regards

 

 

Link to comment
Share on other sites

Are you thinking its some sort WYSIWYG editor?

Smarty is more like a shorthand library than anything else, instead of typing in all the code for a buy button it's  {buy_button} and it's drawing all that info from somewhere else. It does help you manipulate how things are displayed, in that it makes them compartmentalized and global when necessarily/desired.

Using inspect element will help you visualize the changes and approximate the code changes you will need to make in the template do what you want but it's not 100% fool proof (often changing the padding sizes can cause larger changes than inspect element will do, but it's trial and error).

It depends on the Skin, but adding {$PRODUCT.description_short} somewhere in content.product.php, you'd need to edit the code so that it's below {include file='templates/element.product.call_to_action.php'} which includes the buy box.

I'm not using a common skin though, so I don't recall what it is for the others, but the basic principle is the same.

Edited by Lastwolf
Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

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

Guest
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...