Displaying items in shop
-----
| Author | Message | |
|---|---|---|
|
laisvai |
||
| Sun Sep 10, 2006 7:01 am Post subject: Displaying items in shop | ||
|
Hi,
How can i get items displayed on particular shop inventory page, let's say instead of describing it link? right now i can see picture only if i click on item description, so users has to click on all items separately if he wants to look at it. It would be much comfortable if he can see all items displayed and decide what to buy more effectively (click on image, not link to go to sell/buy dialog). Thanks |
||
|
Thoul |
||
| Sun Sep 10, 2006 11:35 pm Post subject: re: Displaying items in shop | ||
|
That sounds like a good application of the per-shop template feature. I'm too tired to go into much detail on it right now, but I'll see what I can do tomorrow.
|
||
|
Thoul |
||
| Mon Sep 11, 2006 11:32 am Post subject: re: Displaying items in shop | ||
|
Here is what you should do to accomplish this.
And then you should have the images displaying in the shop listing, with the images being a clickable link to buy the item. If you want, you can even customize the tpl more to change the display of this one shop. |
||
|
laisvai |
||
| Wed Sep 13, 2006 3:36 pm Post subject: | ||
|
Oh thanks, going to do this right now
|
||
|
laisvai |
||
| Wed Sep 13, 2006 4:24 pm Post subject: | ||
|
Everything works just great
i even didn't know if there is a possibility to choose template, now i can customize it as i want Thank you for your time |
||
|
Thoul |
||
| Wed Sep 13, 2006 4:29 pm Post subject: re: Displaying items in shop | ||
|
Glad you like it. Have fun with it!
|
||
|
laisvai |
||
| Sun Oct 15, 2006 11:50 am Post subject: | ||
|
Hello,
i need help once again. It's regarding items display, i wanna to show them not in one column, but for example in 5 columns, i played a liitle with shop bar addon, look what i done, i also want something like this to do for my other shops:
Problem which i can't solve (sit 2 hours already with this Here is my code for shop_bar.php Code: $template->set_filenames(array(
'body' => 'shop/shop_bar_body.tpl') ); $sql = "SELECT a.* FROM " . SHOP_ITEMS_TABLE . " a, " . SHOP_TABLE . " b WHERE b.url = 'shop_bar.php' AND a.shop = b.shopname"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, "Error getting alcohols!", '', __LINE__, __FILE__, $sql); } $sql_count = $db->sql_numrows($result); if ( $sql_count ) { for ($i = 0; $i < $sql_count; $i++) { if (!( $row = $db->sql_fetchrow($result) )) { message_die(GENERAL_ERROR, "Error getting alcohols!", '', __LINE__, __FILE__, $sql); } $rownum = ( $i % 2 ) ? "row1" : "row2"; if ( $row['sdesc'] < 0 ) { $duration = '-' . duration($row['sdesc'] * -1); } else { $duration = ( !is_numeric($row['sdesc']) || $row['sdesc'] < 1 ) ? $lang['bar_none'] : duration($row['sdesc']); } $template->assign_block_vars('list_items', array( 'ROW_CLASS' => $rownum, 'ITEM_URL' => append_sid("shop_bar.php?action=buy&item_id=" . $row['id']), 'ITEM_NAME' => $row['name'], 'ITEM_DESC' => $row['ldesc'], 'ITEM_LENGTH' => $duration, 'ITEM_COST' => $row['cost'], 'ITEM_STOCK' => $row['stock']) ); } } and shop_bar_body.tpl : Code: <table width="100%" cellpadding="4" cellspacing="1" border="0" align="center" class="forumline">
<tr> <th class="thHead" colspan="5">{L_SHOP_TITLE}</th> </tr> <tr> <!-- BEGIN list_items --> <td class="{list_items.ROW_CLASS}" valign="top" align="center"> <a href="{list_items.ITEM_URL}" title="{L_BUY} {list_items.ITEM_NAME}" class="nav"><b>{list_items.ITEM_NAME}</b><br /> <img src="shop/bar/{list_items.ITEM_NAME}.gif" /></a><br /> <span class="gensmall"><b>{L_INTOX_DUR}:<br />{list_items.ITEM_LENGTH}</b></span><br /> <span class="gensmall"><b>{L_COST}: {list_items.ITEM_COST} lt.</b></span><br /> <span class="gensmall"><b>{L_STOCK}: {list_items.ITEM_STOCK}</b></span> </td> <!-- END list_items --> </tr> <!-- BEGIN switch_no_drinks --> <tr> <td class="row3" colspan="4"><span class="gensmall"><b>{L_NO_DRINKS}</b></span></td> </tr> <!-- END switch_no_drinks --> <!-- BEGIN switch_is_drunk --> <tr> <td class="row3" colspan="4"><span class="gensmall"><b>{switch_is_drunk.L_TIME_LEFT}</b></span></td> </tr> <!-- END switch_is_drunk --> </table> I just move list.items switch after <tr> but now it's all displayed in one row. Thanks. p.s. i know maybe it's very simple, but i never did it before... |
||
|
Zarath |
||
| Sun Oct 15, 2006 10:54 pm Post subject: re: Displaying items in shop | ||
|
Need to add something like
if ( $i % 5 ) { $template->assign_block_vars('break_line', array()); } in the shop_bar.php file then in the template file, after <!-- END list_items --> add something like <!-- BEGIN break_line --> </tr> <tr> <!-- END break_line --> That % 5 means every 5 items it will break line. |
||
|
laisvai |
||
| Mon Oct 16, 2006 4:59 am Post subject: | ||
|
I thought something about that, but this breaks wasn't very clear to me yesterday. I'll test it in the evening, but i think everything should work fine.
If this $i %5 means after every fith $i this if condition = true, then it's activates break line, and inserts new row. I didn't know this expression. Thanks |
||
|
laisvai |
||
| Mon Oct 16, 2006 12:05 pm Post subject: | ||
|
No way no step
it didn't work, i tried everything...seems i don't know something |
||
