konair Posted May 21, 2012 Report Share Posted May 21, 2012 Hallo, suche jetzt schon lange hier im Forum - leider ohne Erfolg. Möchte die Artikel auf der Startseite in drei Spalten nebeneinander darstellen. In meiner product_listing_v1.html existierr aber kein "$maxcol="3"". Ich komme einfach nicht weiter.. Könnt ihr mir helfen? Meine product_listing sieht wie folgt aus: {$categories} {if $product_listing} {if $heading_text}<h1>{$heading_text}</h1>{/if} {if $PRODUCTS_DROPDOWN}{$PRODUCTS_DROPDOWN}{/if} {if $sort_dropdown.options} <div class="products_sort"> {form type=form name=sort_dropdown action='dynamic' method=get} {if isset($current_manufacturer_id)}{form type=hidden name=page value='manufacturers'} {else} {form type=hidden name=page value='categorie'} {/if} {if isset($current_category_id)}{form type=hidden name=cat value=$current_category_id}{/if} {if isset($current_manufacturer_id)}{form type=hidden name=mnf value=$current_manufacturer_id}{/if} {form type=select name=sorting value=$sort_dropdown.options default=$sort_default onchange='this.form.submit();'} {form type=formend} </div> {/if} {if $MANUFACTURER_DROPDOWN} <div class="products_sort"> {if $MANUFACTURER_DROPDOWN}{$MANUFACTURER_DROPDOWN}{/if} </div> {/if} {if $manufacturer.MANUFACTURER.manufacturers_image} {img img=$manufacturer.MANUFACTURER.manufacturers_image type=m_info}<br /> {/if} {if $manufacturer} {$manufacturer.MANUFACTURER.manufacturers_description} {/if} <div class="hrproductpreview"></div> {foreach name=aussen item=module_data from=$product_listing} <table class="productPreview" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> {if $module_data.products_image!=''}<td class="productPreviewImage"><a href="{$module_data.products_link}">{img img=$module_data.products_image type=m_thumb class=productImageBorder alt=$module_data.products_name|escape:"html"}</a></td>{/if} <td class="productPreviewContent"> <h2><a href="{$module_data.products_link}">{$module_data.products_name}</a></h2> {if $module_data.date_available!=''} <ul class="info_info"> <li class="infoInfo">{txt key=TEXT_PRODUCT_AVAILABLE} {$module_data.date_available|date_format:"%A, %B %e, %Y"}</li> </ul> {/if} {if $module_data.review_stars_rating} <div class="reviews_rating_light"><div class="reviews_rating_dark" style="width:{$module_data.review_stars_rating}%"></div></div> {/if} {if $module_data.products_short_description}<p>{$module_data.products_short_description}</p>{/if} {if $smarty.const._CUST_STATUS_SHOW_PRICE eq '1'} <p class="price">{$module_data.products_price.formated}</p> <p class="taxandshippinginfo">{$module_data.products_tax_info.tax_desc}{if $module_data.products_shipping_link}<a href="{$module_data.products_shipping_link}" target="_blank" rel="nofollow">{txt key=TEXT_EXCL_SHIPPING}</a>{/if}</p> {if $module_data.base_price}<p class="vpe">{$module_data.base_price.price} {txt key=TEXT_SHIPPING_BASE_PER} {$module_data.base_price.vpe.name}</p>{/if} {/if} {if $module_data.products_weight > 0}<p class="taxandshippinginfo">{txt key=TEXT_PRODUCTS_WEIGHT}: {$module_data.products_weight|number_format:2:",":"."} KG</p>{/if} {if $module_data.shipping_status}<p class="shippingtime">{txt key=TEXT_SHIPPING_STATUS} {$module_data.shipping_status}</p>{/if} {if $module_data.stock_image} <p class="stockimage">{img img=$module_data.stock_image.image type=t_img_stockrules alt=$module_data.stock_image.name}</p> <p class="stockimagetext">{$module_data.stock_image.name}</p> {/if} {if $module_data.allow_add_cart eq 'true'} {form type=form name=product action='dynamic' link_params=getParams method=post} {form type=hidden name=action value=add_product} {form type=hidden name=product value=$module_data.products_id} <div class="addtobasketlisting"> <table border="0" cellspacing="0" cellpadding="2"> <tr> <td style="width:100%">{form type=text name=qty value=1 style='width:50px;'}</td> <td>{button text=$smarty.const.BUTTON_ADD_CART file='button_in_cart.gif' type='form' btn_template='tpl_button_2.gif' space_left='25'}</td> </tr> </table> </div> {form type=formend} {/if} </td> </tr> </table> <div class="hrproductpreview"></div> {/foreach} <div id="NAVIGATION"> <div class="COUNT">{$NAVIGATION_COUNT}</div> <div class="PAGES">{$NAVIGATION_PAGES}</div> </div>{/if} {$error_listing} Link to comment Share on other sites More sharing options...
oldbear Posted May 21, 2012 Report Share Posted May 21, 2012 hi, für 3spaltige Listings auf Tabellenebene gibts schon seit 3 Jahren fertige Lösungen. ich poste hier mal das Prinzip ( Liste der Hersteller, alles auf Smarty-Basis, ohne PHP-Gedöns ): <!-- 4 spaltiges Listing START --------------------------------------------> {assign var=n value=4} <h2>{$heading_text}</h2> {counter start=0 skip=1 print=false assign=count} <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> {foreach name=aussen item=module_data from=$manufacturers} {counter} <td class="main"> <table width="100%" border="0" cellpadding="0" cellspacing="4"> <tr> <td align="center"> {if $module_data.manufacturers_image} <a href="{$module_data.manufacturers_link}"> {img img=$module_data.manufacturers_image type=m_info width=125} </a> {else} <a href="{$module_data.manufacturers_link}"> {img img='noimage.gif' type=m_info width=125} </a> {/if} </td> </tr> <tr> <td align="center" ><a href="{$module_data.manufacturers_link}">{$module_data.manufacturers_name}</a></td> </tr> </table> </td> {if $count >= $n} {counter start=0 skip=1 print=false assign=count} </tr><tr> {/if} {/foreach} </tr> </table> <!-- 4 spaltiges Listing ENDE ---------------------------------------------> [/HTML] natürlich muss man die css-Klassen je nach Anzahl anpassen, könnte deren Namen aber über die Variable {$n} dynamisch ermitteln, d.h. es gibt z.B. eine Klasse class="liste_mehrspaltig_{$n}" Link to comment Share on other sites More sharing options...
konair Posted May 22, 2012 Author Report Share Posted May 22, 2012 Danke, oldbear. Ich werde das mal ausprobieren. Ich frage mich aber, warum die Lösung mit der Categories per row nicht mehr existiert?! Oder kann ich das irgendwie einbauen? Das fand ich nämlich handlicher. {assign var=maxcol value=$smarty.const._STORE_MAX_CATEGORIES_PER_ROW} {php} $maxcol="2"; if ($col>=$maxcol) { $col=0; echo '</tr><tr>'; } Link to comment Share on other sites More sharing options...
oldbear Posted May 22, 2012 Report Share Posted May 22, 2012 dann machs halt einfach so; der {assign} Befehl holt doch nur die Konstante mit dem Wert 3 , kannst gleich schreiben {assign var=maxcol value=3} Grüsse Link to comment Share on other sites More sharing options...
konair Posted May 22, 2012 Author Report Share Posted May 22, 2012 danke, oldbear! das funktioniert aber nicht. Die Artikel stehen nach wie vor untereinander.. folgender code ist jetzt enthalten: {$categories} {if $product_listing} {if $heading_text}<h1>{$heading_text}</h1>{/if} {if $PRODUCTS_DROPDOWN}{$PRODUCTS_DROPDOWN}{/if} {if $sort_dropdown.options} <div class="products_sort"> {form type=form name=sort_dropdown action='dynamic' method=get} {if isset($current_manufacturer_id)}{form type=hidden name=page value='manufacturers'} {else} {form type=hidden name=page value='categorie'} {/if} {if isset($current_category_id)}{form type=hidden name=cat value=$current_category_id}{/if} {if isset($current_manufacturer_id)}{form type=hidden name=mnf value=$current_manufacturer_id}{/if} {form type=select name=sorting value=$sort_dropdown.options default=$sort_default onchange='this.form.submit();'} {form type=formend} </div> {/if} {if $MANUFACTURER_DROPDOWN} <div class="products_sort"> {if $MANUFACTURER_DROPDOWN}{$MANUFACTURER_DROPDOWN}{/if} </div> {/if} {if $manufacturer.MANUFACTURER.manufacturers_image} {img img=$manufacturer.MANUFACTURER.manufacturers_image type=m_info}<br /> {/if} {if $manufacturer} {$manufacturer.MANUFACTURER.manufacturers_description} {/if} <div class="hrproductpreview"></div> {foreach name=aussen item=module_data from=$product_listing} <table class="productPreview" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> {if $module_data.products_image!=''}<td class="productPreviewImage"><a href="{$module_data.products_link}">{img img=$module_data.products_image type=m_thumb class=productImageBorder alt=$module_data.products_name|escape:"html"}</a></td>{/if} <td class="productPreviewContent"> <h2><a href="{$module_data.products_link}">{$module_data.products_name}</a></h2> {if $module_data.date_available!=''} <ul class="info_info"> <li class="infoInfo">{txt key=TEXT_PRODUCT_AVAILABLE} {$module_data.date_available|date_format:"%A, %B %e, %Y"}</li> </ul> {/if} {if $module_data.review_stars_rating} <div class="reviews_rating_light"><div class="reviews_rating_dark" style="width:{$module_data.review_stars_rating}%"></div></div> {/if} {if $module_data.products_short_description}<p>{$module_data.products_short_description}</p>{/if} {if $smarty.const._CUST_STATUS_SHOW_PRICE eq '1'} <p class="price">{$module_data.products_price.formated}</p> <p class="taxandshippinginfo">{$module_data.products_tax_info.tax_desc}{if $module_data.products_shipping_link}<a href="{$module_data.products_shipping_link}" target="_blank" rel="nofollow">{txt key=TEXT_EXCL_SHIPPING}</a>{/if}</p> {if $module_data.base_price}<p class="vpe">{$module_data.base_price.price} {txt key=TEXT_SHIPPING_BASE_PER} {$module_data.base_price.vpe.name}</p>{/if} {/if} {if $module_data.products_weight > 0}<p class="taxandshippinginfo">{txt key=TEXT_PRODUCTS_WEIGHT}: {$module_data.products_weight|number_format:2:",":"."} KG</p>{/if} {if $module_data.shipping_status}<p class="shippingtime">{txt key=TEXT_SHIPPING_STATUS} {$module_data.shipping_status}</p>{/if} {if $module_data.stock_image} <p class="stockimage">{img img=$module_data.stock_image.image type=t_img_stockrules alt=$module_data.stock_image.name}</p> <p class="stockimagetext">{$module_data.stock_image.name}</p> {/if} {if $module_data.allow_add_cart eq 'true'} {form type=form name=product action='dynamic' link_params=getParams method=post} {form type=hidden name=action value=add_product} {form type=hidden name=product value=$module_data.products_id} <div class="addtobasketlisting"> <table border="0" cellspacing="0" cellpadding="2"> <tr> <td style="width:100%">{form type=text name=qty value=1 style='width:50px;'}</td> <td>{button text=$smarty.const.BUTTON_ADD_CART file='button_in_cart.gif' type='form' btn_template='tpl_button_2.gif' space_left='25'}</td> </tr> </table> </div> {form type=formend} {/if} {assign var=maxcol value=3} </td> </tr> </table> <div class="hrproductpreview"></div> {/foreach} <div id="NAVIGATION"> <div class="COUNT">{$NAVIGATION_COUNT}</div> <div class="PAGES">{$NAVIGATION_PAGES}</div> </div>{/if} {$error_listing} Link to comment Share on other sites More sharing options...
konair Posted May 22, 2012 Author Report Share Posted May 22, 2012 habs jetzt ala ahlfy gelöst.. http://www.xt-commerce.com/forum/fragen-zur-software/71297-mehrere-produkte-nebeneinander.html Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.