<?php
if ($products_all_split->number_of_rows > 0) {
$products_all = $db->Execute($products_all_split->sql_query);
$row_counter = 0;
while (!$products_all->EOF) {
$row_counter++;
if (PRODUCT_ALL_LIST_IMAGE != '0') {
if ($products_all->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) {
$display_products_image = str_repeat('<br clear="all" />', substr(PRODUCT_ALL_LIST_IMAGE, 3, 1));
} else {
$display_products_image = '<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_all->fields['master_categories_id']) . '&products_id=' . $products_all->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $products_all->fields['products_image'], $products_all->fields['products_name'], IMAGE_PRODUCT_ALL_LISTING_WIDTH, IMAGE_PRODUCT_ALL_LISTING_HEIGHT) . '</a>' . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_LIST_IMAGE, 3, 1));
}
} else {
$display_products_image = '';
}
if (PRODUCT_ALL_LIST_NAME != '0') {
$display_products_name = '<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_all->fields['master_categories_id']) . '&products_id=' . $products_all->fields['products_id']) . '"><strong>' . $products_all->fields['products_name'] . '</strong></a>' . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_LIST_NAME, 3, 1));
} else {
$display_products_name = '';
}
//Codice fornitore
if (PRODUCT_ALL_LIST_MODEL != '0' and zen_get_show_product_switch($products_all->fields['products_id'], 'model')) {
$display_products_model = $products_all->fields['products_model'] . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_LIST_MODEL, 3, 1));
} else {
$display_products_model = '';
}
//Codice Produzione
if ($products_all->fields['products_id']) {
$display_products_produzione = $products_all->fields['products_produzione'] . str_repeat('<br clear="all" />');
} else {
$display_products_produzione = '';
}
//Prezzo al dettaglio (Solo per grossisti)
if ($products_all->fields['products_id']) {
$display_products_prezzo = $products_all->fields['products_price'] . str_repeat('<br clear="all" />');
} else {
$display_products_prezzo = '';
}
//Ricarico e margine
if ($products_all->fields['products_id']) {
$display_products_prezzo_dettaglio = $products_all->fields['products_price'] ;
$products_price = zen_get_products_display_price($products_all->fields['products_id']);
$display_products_prezzo_ingrosso = $products_price . (zen_get_show_product_switch($products_all->fields['products_id']));
$perc=100;
$A = $display_products_prezzo_dettaglio-$display_products_prezzo_ingrosso;
$B= $A/$display_products_prezzo_dettaglio;
$MC= $B*100;
$C= $A/$display_products_prezzo_ingrosso;
$MU=$C*100;
}
if (PRODUCT_ALL_LIST_WEIGHT != '0' and zen_get_show_product_switch($products_all->fields['products_id'], 'weight')) {
$display_products_weight = $products_all->fields['products_weight'] . TEXT_SHIPPING_WEIGHT . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_LIST_WEIGHT, 3, 1));
} else {
$display_products_weight = '';
}
if (PRODUCT_ALL_LIST_QUANTITY != '0' and zen_get_show_product_switch($products_all->fields['products_id'], 'quantity')) {
if ($products_all->fields['products_quantity'] <= 0) {
$display_products_quantity = TEXT_OUT_OF_STOCK . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_LIST_QUANTITY, 3, 1));
} else {
$display_products_quantity = $products_all->fields['products_quantity'] . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_LIST_QUANTITY, 3, 1));
}
} else {
$display_products_quantity = '';
}
if (PRODUCT_ALL_LIST_DATE_ADDED != '0' and zen_get_show_product_switch($products_all->fields['products_id'], 'date_added')) {
$display_products_date_added = TEXT_DATE_ADDED . ' ' . zen_date_long($products_all->fields['products_date_added']) . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_LIST_DATE_ADDED, 3, 1));
} else {
$display_products_date_added = '';
}
if (PRODUCT_ALL_LIST_MANUFACTURER != '0' and zen_get_show_product_switch($products_all->fields['products_id'], 'manufacturer')) {
$display_products_manufacturers_name = ($products_all->fields['manufacturers_name'] != '' ? ' ' . $products_all->fields['manufacturers_name'] . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_LIST_MANUFACTURER, 3, 1)) : '');
} else {
$display_products_manufacturers_name = '';
}
if ((PRODUCT_ALL_LIST_PRICE != '0' and zen_get_products_allow_add_to_cart($products_all->fields['products_id']) == 'Y') and zen_check_show_prices() == true) {
$products_price = zen_get_products_display_price($products_all->fields['products_id']);
$display_products_price = ' ' . $products_price . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_LIST_PRICE, 3, 1)) . (zen_get_show_product_switch($products_all->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($products_all->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
} else {
$display_products_price = '';
}
// more info in place of buy now
if (PRODUCT_ALL_BUY_NOW != '0' and zen_get_products_allow_add_to_cart($products_all->fields['products_id']) == 'Y') {
if (zen_has_product_attributes($products_all->fields['products_id'])) {
$link = '<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_all->fields['master_categories_id']) . '&products_id=' . $products_all->fields['products_id']) . '">' . '<br>'. MORE_INFO_TEXT . '</a>';
} else {
// $link= '<a href="' . zen_href_link(FILENAME_PRODUCTS_ALL, zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_all->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</a>';
if (PRODUCT_ALL_LISTING_MULTIPLE_ADD_TO_CART > 0 && $products_all->fields['products_qty_box_status'] != 0) {
// $how_many++;
$link = TEXT_PRODUCT_ALL_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" name=\"products_id[" . $products_all->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
} else {
$link = '<a href="' . zen_href_link(FILENAME_PRODUCTS_ALL, zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_all->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT) . '</a> ';
}
}
$the_button = $link;
$products_link = '<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_all->fields['master_categories_id']) . '&products_id=' . $products_all->fields['products_id']) . '">' . '<br>'. MORE_INFO_TEXT . '</a>';
$display_products_button = zen_get_buy_now_button($products_all->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($products_all->fields['products_id']) . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_BUY_NOW, 3, 1));
} else {
$link = '<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_all->fields['master_categories_id']) . '&products_id=' . $products_all->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
$the_button = $link;
$products_link = '<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_all->fields['master_categories_id']) . '&products_id=' . $products_all->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
$display_products_button = zen_get_buy_now_button($products_all->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($products_all->fields['products_id']) . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_BUY_NOW, 3, 1));
}
if (PRODUCT_ALL_LIST_DESCRIPTION > '0') {
$disp_text = zen_get_products_description($products_all->fields['products_id']);
$disp_text = zen_clean_html($disp_text);
$display_products_description = stripslashes(zen_trunc_string($disp_text, PRODUCT_ALL_LIST_DESCRIPTION, '<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_all->fields['master_categories_id']) . '&products_id=' . $products_all->fields['products_id']) . '"> ' . MORE_INFO_TEXT . '</a>'));
} else {
$display_products_description = '';
}
?>
<table class="tuttiprodotti">
<tr>
<th >Compara</th>
<th >Prodotto</th>
<th>Nome</th>
<th >Codice Fornitore</th>
<th>Codice Produttore</th>
<th>Produttore</th>
<th>Prezzo</th>
<?php if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] != '0' ) {?>
<div class="wholesale"><th>Prezzo al dettaglio</th></div>
<?php } ?>
<?php if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] != '0' ) {?>
<div class="wholesale"><th>Ricarico</th></div>
<?php } ?>
<?php if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] != '0' ) {?>
<div class="wholesale"><th>Margine</th></div>
<?php } ?>
<th>Compra Ora</th>
</tr>
<tr>
<td>
<form name="products" action="index.php?main_page=page_3" method="POST" >
<?php
$array = $products_all->fields['products_id'];
echo $array;
echo '<input type="checkbox" name="products[]" value="'. $array .'">';
?>
<input type=submit value=Select>
</form>
<!--<input type="checkbox" name="products[]" value=".'$products_all->fields['products_id']'" /> -->
</td>
<!-- Immagini-->
<td>
<?php if (PRODUCT_ALL_LIST_IMAGE > '0') {
echo $display_products_image;
?>
</td>
<?php
}
?>
<!-- Nomi-->
<td>
<?php if (PRODUCT_ALL_LIST_NAME > '0') {
echo $display_products_name;
} ?>
</td>
<!-- Nomi-->
<td>
<?php if (PRODUCT_ALL_LIST_MODEL > '0') {
echo $display_products_model;
} ?>
</td>
<td>
<?php if (PRODUCT_ALL_LIST_PRODUZIONE > '0') {
echo $display_products_produzione;
}?>
</td>
<td>
<?php if (PRODUCT_ALL_LIST_MANUFACTURER > '0') {
echo $display_products_manufacturers_name;
} ?>
</td>
<td>
<?php if (PRODUCT_ALL_LIST_PRICE > '0') {
echo $display_products_price;?>
<?php } ?>
</td>
<?php if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] != '0' ) {?>
<td>
<?php if (PRODUCT_ALL_LIST_PRICE > '0') {
echo $display_products_prezzo."EUR";
}} ?>
</td>
<?php if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] != '0' ) {?>
<td>
<?php echo round($MU,1)."%", "<br><br>";
} ?>
</td>
<?php if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] != '0' ) {?>
<td>
<?php echo round($MC,1)."%", "<br><br>";
} ?>
</td>
<td id="buy_now">
<?php if (PRODUCT_ALL_BUY_NOW > '0') {
echo $display_products_button;
?>
</td>
<?php } ?>
</tr>
</table>
<br>
<?php
$products_all->MoveNext();
}
} else {
?>
</p>
<p><?php echo TEXT_NO_ALL_PRODUCTS; ?></p>
<?php
}
?>