X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   conditional left column (https://forum.x-cart.com/showthread.php?t=53773)

ynotcreative 05-16-2010 09:10 PM

conditional left column
 
I am in very quick need to make the product details page left column conditional. To be more specific, I want the left column to disappear on the details page. What I have done so far was to try to create a conditional based upon the url. When it did not work, I moved the if around to try to simplify the task for testing. I am still not able t achieve what I am after. Here is my code. Does anyone see anything obvious?

I have tried the following using both smarty and php, to no avail.
Seriously big kudos and karma points to anyone that can help!

{*
show the url for a baseline
*}
{$canonical_url}
{*
Test conditional remove on product details page
*}
{php}
if (substr ($canonical_url, "product.php?productid=") !== false ) {
"show sidebar"
}
{/php}
<div class="menu-dialog{if $additional_class} {$additional_class}{/if}">
<div class="title-bar valign-middle{if $link_href} link-title{/if}">
{strip}
{if $link_href}
<span class="title-link">
<a href="{$link_href}" class="title-link"><img src="{$ImagesDir}/spacer.gif" alt="" /></a>
</span>
{/if}
<img class="icon ajax-minicart-icon" src="{$ImagesDir}/spacer.gif" alt="" />
<h2>{$title}</h2>
{/strip}
</div>
<div class="content">
{$content}
</div>
</div>

Shamun 05-16-2010 09:56 PM

Re: conditional left column
 
First: Don't use PHP in smarty templates. It's a template engine so any actual 'work' should be done outside.

Second: Your signature shows 4.1 so it should be in that category and not 4.2/4.3

Third: Try something like this:
Code:

{*
show the url for a baseline
*}
{$canonical_url}
{if $main neq 'product'}

<div class="menu-dialog{if $additional_class} {$additional_class}{/if}">
    <div class="title-bar valign-middle{if $link_href} link-title{/if}">
        {strip}
            {if $link_href}
                <span class="title-link">
                    <a href="{$link_href}" class="title-link"><img src="{$ImagesDir}/spacer.gif" alt="" /></a>
                </span>
            {/if}
            <img class="icon ajax-minicart-icon" src="{$ImagesDir}/spacer.gif" alt="" />
            <h2>{$title}</h2>
        {/strip}
    </div>
<div class="content">
    {$content}
</div>
</div>
{/if}


ynotcreative 05-16-2010 10:02 PM

Re: conditional left column
 
Sorry, my signature is way out of date. This is a 4.3.1 installation.

ynotcreative 05-16-2010 10:07 PM

Re: conditional left column
 
Awesome solution, thank you so much!

FTI 05-23-2010 02:32 PM

Re: conditional left column
 
Thats exactly what I needed, thank you very much. Where to put this code in product.tpl? And also is there a way to push the product details all the way to the left, so I can use the free space for larger product image?

Shamun 05-23-2010 03:19 PM

Re: conditional left column
 
Quote:

Originally Posted by FTI
Thats exactly what I needed, thank you very much. Where to put this code in product.tpl? And also is there a way to push the product details all the way to the left, so I can use the free space for larger product image?



To control the left/right nav bar, you need to change the code in the .tpl file its located in... This would/should be skin1/customer/home.tpl


As for pushing product details to the left, you could try changing the details div/span css to:
Code:

float: left;

FTI 05-23-2010 03:39 PM

Re: conditional left column
 
Thank you very much, Sir!

FTI 05-23-2010 03:52 PM

Re: conditional left column
 
Unfortunatelly moving just the product details box to the left seems to be a problem, cause its included in home_main.tpl, which is included in <div id="center-main">, which is in the center of the website... Do you think there is any way to do this?

Shamun 05-23-2010 04:10 PM

Re: conditional left column
 
By product details, I assume you mean weight, price, SKU and extra fields right?
Those are stored in product.tpl and not home_main.tpl

FTI 05-23-2010 04:16 PM

Re: conditional left column
 
1 Attachment(s)
No, sir. I mean to move the whole products detail container to the left. Please see attached image.

Shamun 05-23-2010 04:29 PM

Re: conditional left column
 
For that, you'll have to mess with some other css.
Each template can be different. I checked out the demo on the X-cart site (which is indicated in your URL bar) but could not get it to show as you have it... Though, looking at the CSS there is a 250px margin to the left which pushes it to the right.

Line 288 in the CSS.

FTI 05-23-2010 04:34 PM

Re: conditional left column
 
Well, the problem is that I want to do this only for the product page, not for the whole container. Is it possible in smarty yo assign a custom class to an element and make in not inside the <div id="center-main">. Sorry for the bad example, I had some server problems. This is my site:

http://www.galson.bg/Hunting-Knife-w-sheath.html

Shamun 05-23-2010 04:39 PM

Re: conditional left column
 
for that, you can actually put smarty in the div tags like so:

<div class="{if $main neq 'product'}center-main{else}center-mainP{/if}">

Then make a custom class for center-mainP

FTI 05-23-2010 04:54 PM

Re: conditional left column
 
Thank you so much, Sir. This will do the job :)


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

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.