| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
If/Then statement to show table | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
![]() I'm trying to come up with an if/then statement to show search keywords (in a table) when there are keywords entered, if not then it should not show.
In my case it's a table that needs to be shown with the following code: Code:
This is what I tried (without success): Code:
Can anybody help me with this? Thanks in advance!
__________________
Installs: X-Cart 4.1.x - 4.4.x ∙∙ MySQL version: 5.0.45 ∙∙ Apache version: 2.2.8 (Unix) ∙∙ PHP version: 5.25 X-Cart add-ons: all ∙∙ Mods: A lot; too many ∙∙ Skin templates: Many ∙∙ Experience: Somewhere beyond newbie ![]() ----------------------------------------------------------------------------------------------------------------------------------------- ![]() ![]() |
|||||||||
#2
|
|||||||||
|
|||||||||
![]() try
{if $keywords} You didn't say what is in the $keywords variable. Array? List? Text? An example of the contents would be nice.
__________________
Richard Williams Rogue Wave Limited Initial Inventory Imports Daily Inventory Updates Daily Inventory Reports Drop Ship Support Order Export to Shipper/Supplier Shopping Feeds That Work Programming for X-Cart richard@roguewavelimited.com http://www.roguewavelimited.com |
|||||||||
#3
|
|||||||||
|
|||||||||
![]() Quote:
Unfortunately this doesn't work ![]() Quote:
__________________
Installs: X-Cart 4.1.x - 4.4.x ∙∙ MySQL version: 5.0.45 ∙∙ Apache version: 2.2.8 (Unix) ∙∙ PHP version: 5.25 X-Cart add-ons: all ∙∙ Mods: A lot; too many ∙∙ Skin templates: Many ∙∙ Experience: Somewhere beyond newbie ![]() ----------------------------------------------------------------------------------------------------------------------------------------- ![]() ![]() |
|||||||||
#4
|
|||||||||
|
|||||||||
![]() Hi Warwick!
Please, edit the <xcart_dir>/include/search.php script and replace: PHP Code:
with PHP Code:
After that you'll be able to use the {$keywords} Smarty variable in your templates.
__________________
Eugene Kaznacheev, Evangelist/Product Manager at Ecwid: http://www.ecwid.com/ (since Sept 2009) ex-Head of X-Cart Tech Support Department ex- X-Cart Hosting Manager - X-Cart hosting ex-X-Cart Technical Support Engineer Note: For the official guaranteed tech support services please turn to the Customers HelpDesk. |
|||||||||
#5
|
|||||||||
|
|||||||||
![]() Thanks Eugene!
I have implemented your modification and tried the following statements then but both don't work (yet); forgive me for being such newbie; I must be doing something very stupid. Code:
and Code:
__________________
Installs: X-Cart 4.1.x - 4.4.x ∙∙ MySQL version: 5.0.45 ∙∙ Apache version: 2.2.8 (Unix) ∙∙ PHP version: 5.25 X-Cart add-ons: all ∙∙ Mods: A lot; too many ∙∙ Skin templates: Many ∙∙ Experience: Somewhere beyond newbie ![]() ----------------------------------------------------------------------------------------------------------------------------------------- ![]() ![]() |
|||||||||
#6
|
|||||||||
|
|||||||||
![]() Please add the following code to a necessary template(at the very beginning):
Code:
then refresh the page(or search for any keywrods), do you see any debug info?
__________________
Eugene Kaznacheev, Evangelist/Product Manager at Ecwid: http://www.ecwid.com/ (since Sept 2009) ex-Head of X-Cart Tech Support Department ex- X-Cart Hosting Manager - X-Cart hosting ex-X-Cart Technical Support Engineer Note: For the official guaranteed tech support services please turn to the Customers HelpDesk. |
|||||||||
#7
|
|||||||||
|
|||||||||
![]() I have implemented the code you mentioned in the product template without any if/then statement and get: balancerailArray
(the 'balancerail' being the product name)
__________________
Installs: X-Cart 4.1.x - 4.4.x ∙∙ MySQL version: 5.0.45 ∙∙ Apache version: 2.2.8 (Unix) ∙∙ PHP version: 5.25 X-Cart add-ons: all ∙∙ Mods: A lot; too many ∙∙ Skin templates: Many ∙∙ Experience: Somewhere beyond newbie ![]() ----------------------------------------------------------------------------------------------------------------------------------------- ![]() ![]() |
|||||||||
#8
|
|||||||
|
|||||||
![]() try using {if !empty($keywords)}{/if}
|
|||||||
#9
|
|||||||||
|
|||||||||
![]() Thanks inebriate but this doesn't work either
![]()
__________________
Installs: X-Cart 4.1.x - 4.4.x ∙∙ MySQL version: 5.0.45 ∙∙ Apache version: 2.2.8 (Unix) ∙∙ PHP version: 5.25 X-Cart add-ons: all ∙∙ Mods: A lot; too many ∙∙ Skin templates: Many ∙∙ Experience: Somewhere beyond newbie ![]() ----------------------------------------------------------------------------------------------------------------------------------------- ![]() ![]() |
|||||||||
|
|||
X-Cart forums © 2001-2020
|