Jump to content

Pictures in Product Description & Different display methods


Recommended Posts

Hi,

 

We are going to be adding merchandise to our range, and although I know WHM isnt really designed for that kind of thing, I dont want a whole new cart just for a few items.

 

There are 2 things I cannot seem to get to grips with..

 

1) I am sure I have read or seen that you can use pictures within the product description, if this is so How do you do that, and is there ant instructions on how to do so.

 

2) When looking at the product groups in the cart, they are all listed 1 per row, 1 after the other, which is fine for our game servers and dedi servers. However it would be better if we could get a side by side box view (with pics if possible) for the merchandise group. Basically each row has 2 boxes on it, each with a different product, as opposed to a single product per row.

 

2a) If it is possible to do number 2, can you do this just for one product group and not the others, or do all the groups have to be viewed the same.

 

Many Many thanks in advance to anyone who can help.

Link to comment
Share on other sites

Hi Chris, for Q1, yes you can do this.

 

there's another thread here which gives you more info

http://forum.whmcs.com/showthread.php?t=10017

 

Basically you can add HTML to your product descriptions, so we added tables, formatting and an image reference to acheive the required result

 

Have a look at how we have applied at https://ozsmebusiness.com.au/support/cart.php

 

We've also moved the price & order now button to the right instead of below, to get back some screen real estate. which was done in the products template file in our cart layout

 

Re Q2 there's another thread about have products in 2 columns, so you could combine the approaches.

Whether you have 1 column for some & 2 columns for others depends on what the products are, or how good your understanding of smarty coding is.

 

PM me more specifics if you need to.

Link to comment
Share on other sites

I have managed to get this - https://www.xtrgameservers.com/services/cart.php?a=add&pid=42

 

But I was hoping to have the text to the right of the image, similar to your layout. Is that something that is done within the description box, or is it a template issue?

 

Many thanks for your help btw:-)

 

p.s obviously thats not the pic I will be using, I don't have them back from photographer yet.

Link to comment
Share on other sites

Chris,

 

look in templates/default (or custom)/cart/products.tpl

 

around line 22, change to

{foreach key=num item=product from=$products}

<div class="cartbox" align="center">

<h3>{$product.name}</h3> {if $product.qty!=""}<em>({$product.qty} {$LANG.orderavailable})</em>{/if}

<table>

<tr class="cartbox2">

<td class="cartboxdesc">

{if $product.description}{$product.description}{/if}</td>

<td class="cartboxprice" style="margin:2px;padding:2px;color:#cc0000;">

{if $product.paytype eq "free"}

 

 

 

And around line 33

{if $product.pricing.biennially}{$product.pricing.biennially}<br />{/if}

{/if}

</td>

<td class="cartboxorder"><input type="button" value="{$LANG.ordernowbutton}"{if $product.qty eq "0"} disabled{/if} onclick="window.location='{$smarty.server.PHP_SELF}?a=add&pid={$product.pid}'" /></td>

</tr>

</table>

</div>

<br />

{/foreach}

 

 

then add to your /cart/style.css

Aound line 22

 

.cartbox2 {

width: 100%;

align:left;

background-color: #E6EEFF;

}

 

 

.cartboxdesc {

width: 70%;

align:left;

background-color: #E6EEFF;

}

 

.cartboxprice {

width: 15%;

align:left;

background-color: #E6EEFF;

}

 

.cartboxorder {

width: 15%;

align:left;

background-color: #E6EEFF;

}

 

 

Oviously change the bg

Hope this helps

Link to comment
Share on other sites

OK - I've had a go, and all went well..... so well in fact I tweaked it slightly :)

 

I now have it displaying like this - https://www.xtrgameservers.com/services/cart.php?gid=6

 

It's still not quite how I want it unfortunately. I was blundering about trying to get the pic on the left of the description box with the text from the description on the right, but with no success. What I am after is essentially 3 boxes: -

 

left box - Picture

Centre box - Text Description

Right box - Prices and order button

 

I am begining to think that it isn't possible, as it does mean splitting the data inputed into the product description box.

 

If it is possible, could someone please put me out of my misery.. thanks.

Link to comment
Share on other sites

you would simply create the html with either a 2 column table (left column being the image) or with no tables, and align image left

 

his code is just the structure for the layout.. you have to supply the html for the correct layout of the description/image

Link to comment
Share on other sites

Hi Chris, that looks better.

 

Actually think the price above the order button is better than my layout. perhaps i'll mod mine.

 

take a step back for a second.

 

With the edit to products.tpl, essentially you've got 2 boxes side by side one for product description, and one for price & order button.

 

The picture box is actually your left box split into a further 2 boxes inside the product description area, using HTML

 

So to get your product layout right, you should add some more formatting to the product description. For a hint, have a look at the page source from my earlier link, that should give you a clue ;)

 

if you aren't big on coding, use a code editor like NVU (I HATE fr*ntpage) to arrange some tables, and format them how you want them, then copy the HTML code that it creates, into your product description box

Link to comment
Share on other sites

I might also add, there is no need to add tables with his code.. one can just as easy add in one div and assign an id to the other.. then using CSS, have them display side by side (and not top/bottom as is default)

 

you could also assign an if argument if you wanted only certain products to display this way

 

Here is the code I used to get everything left/right

{foreach key=num item=product from=$products}

<div class="cartbox" align="center">

<h3>{$product.name}</h3> {if $product.qty!=""}<em>({$product.qty} {$LANG.orderavailable})</em>{/if}

<div id="LeftBox">{if $product.description}{$product.description}<br />{/if}</div>

<div id="RighBox" style="margin:5px;padding:2px;color:#cc0000;">

 

and add in this to the templates/yours/cart/style.css

#LeftBox {

float:left;

width:300px; /* or whatever value you want */

}

#RightBox {

float:right;

width:300px; /* Width of the box - may or may not be necessary*/

margin:-5px 0 0 0; /* positions the box next to the other. This will have to be adjusted depending on the LeftBox.*/

}

Link to comment
Share on other sites

OK Now Im confused......

 

So, I now have 2 boxes, and to get the layout I want I use html code in the description box to split the layout further. Which is actually good, as That means I will be able to choose which products to display that way or not.

 

So, with that in mind, the code below, is that what I place in my product description, or does that go in the product.tpl?

 

Or is this just an easier way to achieve the layout I already have? And do I use it to replace the code I recently placed in products.tpl

 

Here is the code I used to get everything left/right

{foreach key=num item=product from=$products}

<div class="cartbox" align="center">

<h3>{$product.name}</h3> {if $product.qty!=""}<em>({$product.qty} {$LANG.orderavailable})</em>{/if}

<div id="LeftBox">{if $product.description}{$product.description}<br />{/if}</div>

<div id="RighBox" style="margin:5px;padding:2px;color:#cc0000;">

 

 

And, will this need to replace the earlier code I placed in my style.css, or is it in addition to the earlier code.

 

and add in this to the templates/yours/cart/style.css

#LeftBox {

float:left;

width:300px; /* or whatever value you want */

}

#RightBox {

float:right;

width:300px; /* Width of the box - may or may not be necessary*/

margin:-5px 0 0 0; /* positions the box next to the other. This will have to be adjusted depending on the LeftBox.*/

}

 

Thank you both for your continued help.

Link to comment
Share on other sites

Actually guys...... Thank you both :)

 

Like Dr Frankenstein creating his monster, I have hacked all 3 code offerings together, and managed to achieve what I want. 2 boxes, but I've sussed how to split the pic and text using the description box in WHM...

 

Normal products - https://www.xtrgameservers.com/services/cart.php

 

3 way split products - https://www.xtrgameservers.com/services/cart.php?gid=6

 

Basically I have this now: -

 

This is in my products.tpl

{foreach key=num item=product from=$products}
<div class="cartbox" align="center">
<h3>{$product.name}</h3> {if $product.qty!=""}<em>({$product.qty} {$LANG.orderavailable})</em>{/if}
<table>
<tr class="cartbox2">
<td class="cartboxdesc">
{if $product.description}{$product.description}{/if}</td>
<td class="cartboxprice" style="margin:2px;padding:2px;color:#cc0000;">
{if $product.paytype eq "free"}
{$LANG.orderfree}
{elseif $product.paytype eq "onetime"}
{$product.pricing.onetime} {$LANG.orderpaymenttermonetime}
{elseif $product.paytype eq "recurring"}
{if $product.pricing.monthly}{$product.pricing.monthly}<br />{/if}
{if $product.pricing.quarterly}{$product.pricing.quarterly}<br />{/if}
{if $product.pricing.semiannually}{$product.pricing.semiannually}<br />{/if}
{if $product.pricing.annually}{$product.pricing.annually}<br />{/if}
{if $product.pricing.biennially}{$product.pricing.bien nially}<br />{/if}
{/if}
<br /><br />
<input type="button" value="{$LANG.ordernowbutton}"{if $product.qty eq "0"} disabled{/if} onclick="window.location='{$smarty.server.PHP_SELF}?a=add&pid={$p roduct.pid}'" /></td>
</tr>
</table>
</div>
<br />
{/foreach}

 

This in my Style.css

.cartbox2 {
width: 650px;
align:left;
background-color: #DDFFD7;
}


.cartboxdesc {
width: 600px;
align:lef;
background-color: #DDFFD7;
}

.cartboxprice {
width: 100px;
border-left: 1px dashed #cccccc;
align:left;
text-align:center;
background-color: #DDFFD7;
}

#picBox {
float:left;
border-right: 1px dashed #cccccc;
width:200px; /* or whatever value you want */
}

#textBox {
float:right;
width:250px; /* Width of the box - may or may not be necessary*/
margin:-5px 0 0 0; /* positions the box next to the other. This will have to be adjusted depending on the LeftBox.*/
}

 

And this is in the product description box in WHM (which can be used just for the products with pics)

<div id="picBox"><img width="150" border="0" Height="200" src="images/Merchandise/xtr_logo.gif"/></div><br />
<div id="textbox"> - Black Continental style rugby shirt,<br />    with white piping and XTR logo<br /> - 100% Cotton<br /> - Available in sizes S, M, L, XL<br /> - <strong>Includes Free Delivery</strong> <em>(Please allow up to 28 days for free delivery)</em></div>

 

Thank you both for you help, and inspiring me. I would never have sussed it without you :D :D :D

Link to comment
Share on other sites

New improved code, for even better layout, as before it affected other layouts that used the 'cartbox' div. It actually looks a bit better too :)

 

Normal products - https://www.xtrgameservers.com/services/cart.php

 

3 way split products - https://www.xtrgameservers.com/services/cart.php?gid=6

 

Basically I have this now: -

 

This is in my products.tpl

{foreach key=num item=product from=$products}
<div class="cartbox" align="center">
<h3>{$product.name}</h3> {if $product.qty!=""}<em>({$product.qty} {$LANG.orderavailable})</em>{/if}
<table>
<tr class="cartbox2">
<td class="cartboxdesc">
{if $product.description}{$product.description}{/if}</td>
<td class="cartboxprice" style="margin:2px;padding:2px;color:#cc0000;">
{if $product.paytype eq "free"}
{$LANG.orderfree}
{elseif $product.paytype eq "onetime"}
{$product.pricing.onetime} {$LANG.orderpaymenttermonetime}
{elseif $product.paytype eq "recurring"}
{if $product.pricing.monthly}{$product.pricing.monthly}<br /><br />{/if}
{if $product.pricing.quarterly}{$product.pricing.quarterly}<br /><br />{/if}
{if $product.pricing.semiannually}{$product.pricing.semiannually}<br /><br />{/if}
{if $product.pricing.annually}{$product.pricing.annually}<br />{/if}
{if $product.pricing.biennially}{$product.pricing.bien nially}<br />{/if}
{/if}
<br /><br />
<div align="center"><input type="button" value="{$LANG.ordernowbutton}"{if $product.qty eq "0"} disabled{/if} onclick="window.location='{$smarty.server.PHP_SELF}?a=add&pid={$product.pid}'" /></div>
</tr>
</table>
</div>
<br />
{/foreach}

 

This in my Style.css

.cartbox {
width: 90%;
margin-left: auto;
margin-right: auto;
padding: 10px;
background-color: #dbefbb;
border: 1px dashed #cccccc;
}

.cartbox2 {
width: 650px;
align:left;
background-color: #DDFFD7;
}


.cartboxdesc {
width: 600px;
align:lef;
background-color: #DDFFD7;
}

.cartboxprice {
width: 100px;
border-left: 1px dashed #cccccc;
align:left;
text-align:center;
background-color: #DDFFD7;
}

#picBox {
float:left;
width:200px;
}

#textBox {
float:right;
width:250px;
margin:-5px 0 0 0;
}

 

See guys you have created a monster now... I'll be at this all day :)

 

p.s I would have edited my last post, but the time had expired :(

Link to comment
Share on other sites

Yes, but it did help. :)

 

I now have a problem, whcih appears to be caused by the changes I have made....

 

although the products are displaying EXACTLY how I want them to when looking at the cart view, when I click the order now button I get this :-

 

https://www.xtrgameservers.com/services/cart.php?a=add&pid=0000000047

 

I knew it was going too well lol

 

Any ideas on what I should be changing, as it appears to be using the same info I have just changed, so if I change it, I lose the layout I want on the cart page :?

 

Thnaks again.

Link to comment
Share on other sites

If you go from here - https://www.xtrgameservers.com/services/cart.php?gid=0000000006

 

and click the order now button, thats what takes you to the page I am having problems with.

 

Actually as Im typing I have had a thought....and tested my suspicion.

 

I am using firefox, and after chacking it on IE, it displays correctly.

 

So it seems to be an issue with how FF is displaying the page :(

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated