Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

PHP and Smarty coding mods for newbie???

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-16-2008, 06:54 PM
 
spia spia is offline
 

Member
  
Join Date: Jul 2008
Posts: 21
 

Arrow PHP and Smarty coding mods for newbie???

Hi,

My 1st store is working but nowhere near live yet. I'm just getting the feel for the template system and understand that there is PHP coding within the HTML and that CSS and HTML can be modified just like any other web site.

My question; is how to change some of the PHP (and Smarty?) coding? Really, how to even find it? I'm not talking about programing in PHP, simply changing some simple wording.

Specifically:

In top_menu.tpl, line 23 is this:

Code:
{if $config.Company.company_phone}{$lng.lbl_phone_1_title}: {$config.Company.company_phone}{/if}{if $config.Company.company_phone_2}&nbsp;&nbsp;&nbsp;{$lng.lbl_phone_2_title}: {$config.Company.company_phone_2}{/if}&nbsp;&nbsp;</td>

That adds the "CALL US: 555.555.5555" to the header. We want to reword that to something like: If you need assitance call us at: 555.555.5555

The change has nothing to do with functionality, just verbiage, so where/how do I make that change (and similar types of changes)?

Thanks guys!
__________________
Gold 4.1.10
Reply With Quote
  #2  
Old 07-16-2008, 07:00 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: PHP and Smarty coding mods for newbie???

Ok, it isn't PHP, it is Smarty and all of it can be controlled one of two ways:

1. Webmaster Mode - read about this in the manual, it will be your best friend.

2. In the 'Languages' area of the admin - also covered pretty well in the manual.

It looks much more complicated than it really is, you will never have to actually edit the text in the templates, it is all in the database and is controlled via Webmaster mode or the Languages area.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 07-16-2008, 09:36 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: PHP and Smarty coding mods for newbie???

Or at times the general settings -> company options section, or in the payment configuration section, or some deeply buried section that will simply take time, effort and possibly forum research to locate
Reply With Quote
  #4  
Old 07-17-2008, 11:42 AM
 
spia spia is offline
 

Member
  
Join Date: Jul 2008
Posts: 21
 

Arrow Re: PHP and Smarty coding mods for newbie???

Quote:
Originally Posted by balinor
1. Webmaster Mode - read about this in the manual, it will be your best friend.

OK... so you're saying that when I click "Open customer area in a new window", in webmaster mode, the list of "Included templates & config files" are all I need to work with to change or reformat the design/layout, basic functions of the site?

Thanks guys!
__________________
Gold 4.1.10
Reply With Quote
  #5  
Old 07-17-2008, 11:45 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: PHP and Smarty coding mods for newbie???

No, webmaster mode will just let you change the text and let you know which template is which. To actually change layout, graphics and color, you have to edit the html in the templates, and the styles in the master stylesheet.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #6  
Old 07-17-2008, 11:49 AM
 
spia spia is offline
 

Member
  
Join Date: Jul 2008
Posts: 21
 

Default Re: PHP and Smarty coding mods for newbie???

Going back to my example in my original post... I cannot find anything for the text "CALL US..." in the customer/top_menu.tpl template except the code I originally posted. I still don't understand then how I can reword that. Can you explain?

Thanks!
__________________
Gold 4.1.10
Reply With Quote
  #7  
Old 07-17-2008, 12:04 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: PHP and Smarty coding mods for newbie???

Yea, you aren't getting what I'm saying. Open the site in webmaster mode. Click on that text, you can edit it right there.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #8  
Old 07-17-2008, 12:09 PM
 
spia spia is offline
 

Member
  
Join Date: Jul 2008
Posts: 21
 

Arrow Re: PHP and Smarty coding mods for newbie???

I do understand what you're saying... I just don't see the text. Either I'm blind to it or it's part of the code. If you have a moment, please look at the file in your store and let me know if I need to see the optometrist or not.

Thanks a lot!
__________________
Gold 4.1.10
Reply With Quote
  #9  
Old 07-17-2008, 01:16 PM
 
Asiaplay Asiaplay is offline
 

X-Wizard
  
Join Date: Oct 2005
Posts: 1,242
 

Default Re: PHP and Smarty coding mods for newbie???

Hi Spia,

You have used webmaster correctly and found the code which corresponds to the text you want to change.

I am about to sleep - so quick reply without checking.

Assuming your code example is correct, then it is telling me that smarty language variable holds the text "CALL US:" is "lbl_phone_1_title" (note: the lng. in front of this is telling smarty to use the current language version of this smarty variable e.g. if someone was in French on your store they would get the French version of the language variable "lbl_phone_1_title" and not the English one - just explaining the meaning of "lng." for you).

The easiest way is to change the text for this language variable "lbl_phone_1_title".

So in X-Cart Admin open the "Administration" -> "Languages" page and choose "English" for the selected language.
This will then reload the page and show a list of all the smarty language variables used for English within your store (there are around 5000 for customer and admin side - so do not go page to page to search for this).
In the search box (find) put in "lbl_phone_1_title" (without quotes obviously) and click to search for this variable (you could also put in "CALL US" - but that might not show just one language variable - so "lbl_phone_1_title" is best idea).

Manually change the text in the box for this field "lbl_phone_1_title", to read "If you need assistance call us at" (note the colon ":" is not needed in the text in this box, as it appears in the template code example you showed above).
Then click the save (update) button.

Refresh your homepage in your browser and you should see the changed text appear.
If it does not appear - clear your browser cache (e.g. Tools, Clear Private Data in Firefox browser) and try to view again...

Hope this helps - cheers, Asiaplay

PS: an alternative method is to add a new language variable in X-Cart languages (e.g. "lbl_phone_1_title_custom4me" and change the template line to use that - however I wouldn't bother adding a language variable in this case and changing the template (as no need for a simple change like this)... and would just change the text of the present "lbl_phone_1_title" being used (i.e. change standard X-Cart text as suggested above).
__________________
X-Cart Gold version 4.1.9
(plus built in X-Cart bugs!)
Reply With Quote
  #10  
Old 07-17-2008, 06:49 PM
 
spia spia is offline
 

Member
  
Join Date: Jul 2008
Posts: 21
 

Arrow Re: PHP and Smarty coding mods for newbie???

Great advice - Thank You! At least I don't need to see the optometrist...

A few more questions:

How difficult is it to add new language variables and where does that go?

Is that a Smarty thing and does that require PHP or Smarty coding skills as well?

There seems to be a massive learning curve to create a graphically (not so much functionally) custom site. Am I right about this because it is discouraging?
__________________
Gold 4.1.10
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:51 PM.

   

 
X-Cart forums © 2001-2020