function outputCompareProductsTable() { global $osC_Language, $osC_Image, $osC_Weight; $content = ''; $products_images = ''; $products_titles = ''; $products_price = ''; $products_weight = ''; $products_sku = ''; $products_manufacturers = ''; $products_desciptions = ''; $products_attributes = ''; if ($this->hasContents()) { foreach ($this->getProducts() as $products_id) { $osC_Product = new osC_Product($products_id); $image = $osC_Product->getImages(); $products_images .= '<td width="120" valign="top" align="center">' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $products_id), $osC_Image->show($image[0]['image'], $osC_Product->getTitle())) . '<br /><br />' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $products_id . '&action=cart_add'), osc_draw_image_button('button_in_cart.gif', $osC_Language->get('button_add_to_cart'))) . '</td>'; $products_titles .= '<td valign="top" align="center">' . $osC_Product->getTitle() . '</td>'; $products_price .= '<td valign="top" align="center">' . $osC_Product->getPriceFormated(true) . '</td>'; $products_weight .= '<td valign="top" align="center">' . $osC_Weight->display($osC_Product->getWeight(), $osC_Product->getWeightClass()) . '</td>'; $products_sku .= '<td valign="top" align="center">' . $osC_Product->getSKU() . '</td>'; $products_manufacturers .= '<td valign="top" align="center">' . $osC_Product->getManufacturer() . '</td>'; $products_desciptions .= '<td valign="top" align="center">' . $osC_Product->getDescription() . '</td>'; if ($osC_Product->hasAttributes()) { foreach ($osC_Product->getAttributes() as $attribute) { $products_attributes[$attribute['name']][$products_id] = $attribute['value']; } } } $content .= '<table id="compareProducts" cellspacing="0" cellpadding="2" border="0">'; $content .= '<tr class="odd"><td width="120"> </td>' . $products_images . '</tr>'; $content .= '<tr class="even"><td valign="top" align="left" class="label">' . $osC_Language->get('field_products_name') . '</td>' . $products_titles . '</tr>'; $content .= '<tr class="odd"><td valign="top" align="left" class="label">' . $osC_Language->get('field_products_price') . '</td>' . $products_price . '</tr>'; $content .= '<tr class="even"><td valign="top" align="left" class="label">' . $osC_Language->get('field_products_weight') . '</td>' . $products_weight . '</tr>'; $content .= '<tr class="odd"><td valign="top" align="left" class="label">' . $osC_Language->get('field_products_sku') . '</td>' . $products_sku . '</tr>'; $content .= '<tr class="even"><td valign="top" align="left" class="label">' . $osC_Language->get('field_products_manufacturer') . '</td>' . $products_manufacturers . '</tr>'; if (!empty($products_attributes)) { $rows = 0; foreach ($products_attributes as $name => $attribute) { $content .= '<tr class="' . ($rows / 2 == floor($rows / 2) ? 'odd' : 'even') . '">'; $content .= '<td valign="top" align="left" class="label">' . $name . ':</td>'; foreach ($this->getProducts() as $products_id) { if (isset($attribute[$products_id])) { $content .= '<td align = "center">' . $attribute[$products_id] . '</td>'; } else { $content .= '<td align = "center"> -- </td>'; } } $content .= '</tr>'; $rows++; } } $content .= '<tr class="' . ($rows / 2 == floor($rows / 2) ? 'odd' : 'even') . '"><td valign="top" align="left" class="label">' . $osC_Language->get('field_products_description') . '</td>' . $products_desciptions . '</tr>'; $content .= '</table></div>'; } return $content; }
function buildProductsRss($group) { global $osC_Language, $osC_Image; $group_title = $group . '_products'; $rss = array(); $rss['rss'] = array(); $rss['rss attr'] = array('xmlns:atom' => 'http://www.w3.org/2005/Atom', 'version' => '2.0'); //channel $rss['rss']['channel'] = array('title' => '<![CDATA[' . $osC_Language->get($group_title) . ']]>', 'link' => '<![CDATA[' . osc_href_link(FILENAME_PRODUCTS, $group) . ']]>', 'description' => '<![CDATA[' . $osC_Language->get($group_title) . ']]>', 'pubDate' => date("D, d M Y H:i:s O")); //items if ($group == "new") { $Qproducts = osC_Product::getListingNew(); } else { if ($group == 'special') { $Qproducts = osC_Specials::getListing(); } else { if ($group == 'feature') { $Qproducts = osC_Product::getListingFeature(); } } } $items = array(); while ($Qproducts->next()) { $osC_Product = new osC_Product($Qproducts->valueInt('products_id')); $link = osc_href_link(FILENAME_PRODUCTS, $Qproducts->valueInt('products_id'), 'NONSSL', false, false, true); $description = ' <![CDATA[ <table> <tr> <td align="center" valign="top">' . osc_link_object($link, osc_image($osC_Image->getImageUrl($osC_Product->getImage(), 'product_info'), $osC_Product->getTitle())) . '</td> <td valign="top">' . $osC_Product->getDescription() . '</td> </tr> </table> ]]>'; $items[] = array('title' => '<![CDATA[' . $osC_Product->getTitle() . ' -- ' . $osC_Product->getPriceFormated() . ']]>', 'link' => '<![CDATA[' . $link . ']]>', 'description' => $description, 'pubDate' => date("D, d M Y H:i:s O")); } $rss['rss']['channel']['item'] = $items; return $rss; }
function outputCompareProductsTable() { global $osC_Language, $osC_Image, $osC_Weight, $osC_Currencies; $content = ''; $products_images = array(); $products_titles = array(); $products_price = array(); $products_weight = array(); $products_sku = array(); $products_manufacturers = array(); $products_desciptions = array(); $products_attributes = array(); $products_variants = array(); $cols = array('<col width="20%">'); $col_width = round(80 / count($this->getProducts())); if ($this->hasContents()) { foreach ($this->getProducts() as $products_id) { $cols[] = '<col width="' . $col_width . '%">'; $osC_Product = new osC_Product($products_id); $image = $osC_Product->getImages(); $product_title = $osC_Product->getTitle(); $product_price = $osC_Product->getPriceFormated(true); $product_weight = $osC_Product->getWeight(); $product_sku = $osC_Product->getSKU(); //if the product have any variants, it means that the $products_id should be a product string such as 1#1:1;2:2 $variants = array(); if ($osC_Product->hasVariants()) { $product_variants = $osC_Product->getVariants(); if (preg_match('/^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)+$/', $products_id)) { $products_variant = $product_variants[$products_id]; $variants = osc_parse_variants_from_id_string($products_id); } else { $products_variant = $osC_Product->getDefaultVariant(); $variants = $products_variant['groups_id']; } //if the product have any variants, get the group_name:value_name string if (isset($products_variant) && isset($products_variant['groups_name']) && is_array($products_variant['groups_name']) && !empty($products_variant['groups_name'])) { $products_variants[$products_id]['variants'] = array(); foreach ($products_variant['groups_name'] as $groups_name => $value_name) { $products_variants[$products_id]['variants'][] = array('name' => $groups_name, 'value' => $value_name); } } $product_price = $osC_Currencies->displayPrice($osC_Product->getPrice($variants), $osC_Product->getTaxClassID()); $product_weight = $products_variant['weight']; $product_sku = $products_variant['sku']; $image = $products_variant['image']; } $image = is_array($image) ? $image[0]['image'] : $image; $products_titles[] = $product_title; if (!osc_empty($product_price)) { $products_price[] = $product_price; } if (!osc_empty($product_weight)) { $products_weight[] = $osC_Weight->display($product_weight, $osC_Product->getWeightClass()); } if (!osc_empty($product_sku)) { $products_sku[] = $product_sku; } if (!osc_empty($osC_Product->getManufacturer())) { $products_manufacturers[] = $osC_Product->getManufacturer(); } if (!osc_empty($osC_Product->getDescription())) { $products_desciptions[] = $osC_Product->getDescription(); } if ($osC_Product->hasAttributes()) { foreach ($osC_Product->getAttributes() as $attribute) { $products_attributes[$products_id]['attributes'][] = array('name' => $attribute['name'], 'value' => $attribute['value']); } } $products_id = str_replace('#', '_', $products_id); $products_images[] = '<div class="image">' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $products_id), $osC_Image->show($image, $osC_Product->getTitle())) . '</div>' . '<div class="button">' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $products_id . '&action=cart_add' . (osc_empty(osc_parse_variants_array($variants)) ? '' : '&variants=' . osc_parse_variants_array($variants))), osc_draw_image_button('button_in_cart.gif', $osC_Language->get('button_add_to_cart'))) . '</div>'; } $content .= '<table id="compareProducts" cellspacing="0" cellpadding="2" border="0">'; //add col groups $content .= '<colgroup>'; foreach ($cols as $col) { $content .= $col; } $content .= '</colgroup>'; //add product header $content .= '<tbody>'; $content .= '<tr class="first">'; $content .= '<th> </th>'; if (!osc_empty($products_images)) { foreach ($products_images as $k => $product_image) { $content .= '<td' . ($k == count($products_images) - 1 ? ' class="last"' : '') . '>' . $product_image . '</td>'; } } $content .= '</tr>'; $content .= '</tbody>'; //add compare details $content .= '<tbody>'; $row_class = 'even'; //add product name if (!osc_empty($products_titles)) { $content .= '<tr class="' . $row_class . '">' . '<th>' . $osC_Language->get('field_products_name') . '</th>'; foreach ($products_titles as $k => $product_title) { $content .= '<td' . ($k == count($products_titles) - 1 ? ' class="last"' : '') . '>' . $product_title . '</td>'; } $content .= '</tr>'; $row_class = $row_class == 'even' ? 'odd' : 'even'; } //add product price if (!osc_empty($products_price)) { $content .= '<tr class="' . $row_class . '">' . '<th>' . $osC_Language->get('field_products_price') . '</th>'; foreach ($products_price as $k => $product_price) { $content .= '<td' . ($k == count($products_price) - 1 ? ' class="last"' : '') . '>' . $product_price . '</td>'; } $content .= '</tr>'; $row_class = $row_class == 'even' ? 'odd' : 'even'; } //add product weight if (!osc_empty($products_weight)) { $content .= '<tr class="' . $row_class . '">' . '<th>' . $osC_Language->get('field_products_weight') . '</th>'; foreach ($products_weight as $k => $product_weight) { $content .= '<td' . ($k == count($products_weight) - 1 ? ' class="last"' : '') . '>' . $product_weight . '</td>'; } $content .= '</tr>'; $row_class = $row_class == 'even' ? 'odd' : 'even'; } //add product sku if (!osc_empty($products_sku)) { $content .= '<tr class="' . $row_class . '">' . '<th>' . $osC_Language->get('field_products_sku') . '</th>'; foreach ($products_sku as $k => $product_sku) { $content .= '<td' . ($k == count($products_sku) - 1 ? ' class="last"' : '') . '>' . $product_sku . '</td>'; } $content .= '</tr>'; $row_class = $row_class == 'even' ? 'odd' : 'even'; } //add product manufacturers if (!osc_empty($products_manufacturers)) { $content .= '<tr class="' . $row_class . '">' . '<th>' . $osC_Language->get('field_products_manufacturer') . '</th>'; foreach ($products_manufacturers as $k => $product_manufacturer) { $content .= '<td' . ($k == count($products_manufacturers) - 1 ? ' class="last"' : '') . '>' . $product_manufacturer . '</td>'; } $content .= '</tr>'; $row_class = $row_class == 'even' ? 'odd' : 'even'; } //add product variants if (!osc_empty($products_variants)) { $content .= '<tr class="' . $row_class . '">' . '<th>' . $osC_Language->get('field_products_variants') . '</th>'; foreach ($this->getProducts() as $k => $products_id) { if (isset($products_variants[$products_id]['variants']) && !osc_empty($products_variants[$products_id]['variants'])) { $content .= '<td' . ($k == count($this->getProducts()) - 1 ? ' class="last"' : '') . '>'; foreach ($products_variants[$products_id]['variants'] as $variant) { $content .= '<span class="variant">' . $variant['name'] . ': ' . $variant['value'] . '</span>'; } $content .= '</td>'; } } $content .= '</tr>'; $row_class = $row_class == 'even' ? 'odd' : 'even'; } //add product attributes if (!osc_empty($products_attributes)) { $content .= '<tr class="' . $row_class . '">' . '<th>' . $osC_Language->get('field_products_attributes') . '</th>'; foreach ($this->getProducts() as $k => $products_id) { if (isset($products_attributes[$products_id]['attributes']) && !osc_empty($products_attributes[$products_id]['attributes'])) { $content .= '<td' . ($k == count($this->getProducts()) - 1 ? ' class="last"' : '') . '>'; foreach ($products_attributes[$products_id]['attributes'] as $attribute) { $content .= '<span class="attribute">' . $attribute['name'] . ': ' . $attribute['value'] . '</span>'; } $content .= '</td>'; } } $content .= '</tr>'; $row_class = $row_class == 'even' ? 'odd' : 'even'; } //add product description if (!osc_empty($products_desciptions)) { $content .= '<tr class="' . $row_class . ' last">' . '<th>' . $osC_Language->get('field_products_description') . '</th>'; foreach ($products_desciptions as $k => $product_description) { $content .= '<td' . ($k == count($products_desciptions) - 1 ? ' class="last"' : '') . '>' . $product_description . '</td>'; } $content .= '</tr>'; $row_class = $row_class == 'even' ? 'odd' : 'even'; } $content .= '</tbody>'; $content .= '</table>'; } return $content; }
?> <div class="featured-banner"></div> <?php } ?> <div class="left"> <?php echo osc_link_object(osc_href_link(FILENAME_PRODUCTS, $product['products_id']), $product['products_image'], 'id="img_ac_newproductsmodule_' . $product['products_id'] . '"'); ?> <h3><?php echo osc_link_object(osc_href_link(FILENAME_PRODUCTS, $product['products_id']), $product['products_name']); ?> </h3> <p class="description"><?php echo strip_tags($osC_Product->getDescription()); ?> </p> </div> <div class="right"> <span class="price"><?php echo $osC_Product->getPriceFormated(true); ?> </span> <span class="buttons hidden-phone"> <a id="ac_newproductsmodule_<?php echo $product['products_id']; ?> " class="btn btn-small btn-info ajaxAddToCart" href="<?php echo osc_href_link(FILENAME_PRODUCTS, $product['products_id'] . '&action=cart_add'); ?>
function process_button() { global $osC_ShoppingCart, $osC_Tax, $osC_Language, $osC_Currencies, $osC_Session; require_once 'includes/classes/product.php'; require_once 'ext/googlecheckout/googlecart.php'; require_once 'ext/googlecheckout/googleitem.php'; require_once 'ext/googlecheckout/googleshipping.php'; $cart = new GoogleCart(MODULE_PAYMENT_GCHECKOUT_MERCHANT_ID, MODULE_PAYMENT_GCHECKOUT_MERCHANT_KEY, MODULE_PAYMENT_GCHECKOUT_SERVER, MODULE_PAYMENT_GCHECKOUT_CURRENCY); //transfer the whole cart if (MODULE_PAYMENT_GCHECKOUT_TRANSFER_CART == '1') { //products $products = $osC_ShoppingCart->getProducts(); foreach ($products as $product) { $name = $product['name']; //gift certificate if ($product['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) { $name .= "\n" . ' - ' . $osC_Language->get('senders_name') . ': ' . $product['gc_data']['senders_name']; if ($product['gc_data']['type'] == GIFT_CERTIFICATE_TYPE_EMAIL) { $name .= "\n" . ' - ' . $osC_Language->get('senders_email') . ': ' . $product['gc_data']['senders_email']; } $name .= "\n" . ' - ' . $osC_Language->get('recipients_name') . ': ' . $product['gc_data']['recipients_name']; if ($product['gc_data']['type'] == GIFT_CERTIFICATE_TYPE_EMAIL) { $name .= "\n" . ' - ' . $osC_Language->get('recipients_email') . ': ' . $product['gc_data']['recipients_email']; } $name .= "\n" . ' - ' . $osC_Language->get('message') . ': ' . $product['gc_data']['message']; } //variants $variants_array = array(); if ($osC_ShoppingCart->hasVariants($product['id'])) { foreach ($osC_ShoppingCart->getVariants($product['id']) as $variants) { $variants_array[$variants['groups_id']] = $variants['variants_values_id']; $name .= "\n" . ' - ' . $variants['groups_name'] . ': ' . $variants['values_name']; } } //get tax $tax = $osC_Tax->getTaxRate($product['tax_class_id'], $osC_ShoppingCart->getTaxingAddress('country_id'), $osC_ShoppingCart->getTaxingAddress('zone_id')); if (DISPLAY_PRICE_WITH_TAX == '1') { $price = $osC_Currencies->addTaxRateToPrice($product['final_price'], $tax); } else { $price = $product['final_price'] + osc_round($product['final_price'] * ($tax / 100), $osC_Currencies->currencies[DEFAULT_CURRENCY]['decimal_places']); } $osC_Product = new osC_Product($product['id']); $gitem = new GoogleItem($name, $osC_Product->getDescription(), intval($product['quantity']), $price); $gitem->SetMerchantPrivateItemData(new MerchantPrivateItemData(array('item' => base64_encode(serialize($product))))); $gitem->SetMerchantItemId($product['id']); $cart->AddItem($gitem); } //add order totals modules into gcheckout cart as item such as: coupon, gift certificate, low order fee //exclude modules: sub_total, tax, total and shipping module $shipping_cost = 0; foreach ($osC_ShoppingCart->getOrderTotals() as $total) { if (!in_array($total['code'], $this->_ignore_order_totals) && strstr($total['code'], 'shipping') === FALSE) { $gitem = new GoogleItem($total['title'], '', '1', $total['value'] + $total['tax']); $gitem->SetMerchantPrivateItemData(new MerchantPrivateItemData(array('order_total' => base64_encode(serialize($total))))); $cart->AddItem($gitem); } else { if (strstr($total['code'], 'shipping') !== FALSE) { $shipping_cost = $total['value'] + $total['tax']; } } } //shipping method $cart->AddShipping(new GooglePickUp($osC_ShoppingCart->getShippingMethod('title'), $shipping_cost)); } else { $gitem = new GoogleItem(STORE_NAME, '', 1, $osC_ShoppingCart->getTotal()); $gitem->SetMerchantPrivateItemData(new MerchantPrivateItemData(array('item' => base64_encode(serialize(STORE_NAME))))); $cart->AddItem($gitem); } //continue shopping url $cart->SetContinueShoppingUrl(osc_href_link(FILENAME_CHECKOUT, 'process', 'NOSSL', null, null, true)); //edit cart url $cart->SetEditCartUrl(osc_href_link(FILENAME_CHECKOUT, '', 'NOSSL', null, null, true)); // Request buyer's phone number $cart->SetRequestBuyerPhone(false); $private_data = $osC_Session->getID() . ';' . $osC_Session->getName(); $cart->SetMerchantPrivateData(new MerchantPrivateData(array('orders_id' => $this->_order_id, 'session-data' => $private_data))); // Display Google Checkout button return $cart->CheckoutButtonCode(); }
function output_compare_products_table() { global $osC_Language, $osC_Image, $osC_Weight, $osC_Currencies, $toC_Compare_Products, $osC_Services; $content = ''; $products_images = array(); $products_titles = array(); $products_price = array(); $products_weight = array(); $products_sku = array(); $products_manufacturers = array(); $products_desciptions = array(); $products_attributes = array(); $products_variants = array(); $cols = array('<col width="20%">'); $col_width = round(80 / count($toC_Compare_Products->getProducts())); if ($toC_Compare_Products->hasContents()) { foreach ($toC_Compare_Products->getProducts() as $products_id_string) { $cols[] = '<col width="' . $col_width . '%">'; $osC_Product = new osC_Product($products_id_string); $products_id = osc_get_product_id($products_id_string); $image = $osC_Product->getImages(); $product_title = $osC_Product->getTitle(); $product_price = $osC_Product->getPriceFormated(true); $product_weight = $osC_Product->getWeight(); $product_sku = $osC_Product->getSKU(); //if the product have any variants, it means that the $products_id should be a product string such as 1#1:1;2:2 $variants = array(); if ($osC_Product->hasVariants()) { $product_variants = $osC_Product->getVariants(); if (preg_match('/^[0-9]+(?:#?(?:[0-9]+:?[0-9]+)+(?:;?([0-9]+:?[0-9]+)+)*)+$/', $products_id_string)) { $products_variant = $product_variants[$products_id_string]; $variants = osc_parse_variants_from_id_string($products_id_string); } else { $products_variant = $osC_Product->getDefaultVariant(); $variants = $products_variant['groups_id']; } //if the product have any variants, get the group_name:value_name string if (isset($products_variant) && isset($products_variant['groups_name']) && is_array($products_variant['groups_name']) && !empty($products_variant['groups_name'])) { $products_variants[$products_id_string]['variants'] = array(); foreach ($products_variant['groups_name'] as $groups_name => $value_name) { $products_variants[$products_id_string]['variants'][] = array('name' => $groups_name, 'value' => $value_name); } } $product_price = $osC_Currencies->displayPrice($osC_Product->getPrice($variants), $osC_Product->getTaxClassID()); $product_weight = $products_variant['weight']; $product_sku = $products_variant['sku']; $image = $products_variant['image']; } $image = is_array($image) ? $image[0]['image'] : $image; $products_titles[] = $product_title; if (!osc_empty($product_price)) { $products_price[] = $product_price; } if (!osc_empty($product_weight)) { $products_weight[] = $osC_Weight->display($product_weight, $osC_Product->getWeightClass()); } if (!osc_empty($product_sku)) { $products_sku[] = $product_sku; } if (!osc_empty($osC_Product->getManufacturer())) { $products_manufacturers[] = $osC_Product->getManufacturer(); } if (!osc_empty($osC_Product->getDescription())) { $products_desciptions[] = $osC_Product->getDescription(); } if ($osC_Product->hasAttributes()) { foreach ($osC_Product->getAttributes() as $attribute) { $products_attributes[$products_id]['attributes'][] = array('name' => $attribute['name'], 'value' => $attribute['value']); } } $products_id_string = str_replace('#', '_', $products_id_string); //used to fix bug [#209 - Compare / wishlist variant problem] if (isset($osC_Services) && $osC_Services->isStarted('sefu') && count($variants) > 0) { $products_images[] = '<div class="image">' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $products_id), $osC_Image->show($image, $osC_Product->getTitle())) . '</div>' . '<div class="button">' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $products_id . '&pid=' . $products_id_string . '&action=cart_add'), '<i class="icon-shopping-cart icon-white"></i> ' . $osC_Language->get('button_add_to_cart'), 'class="btn btn-mini"') . '</div>'; } else { $products_images[] = '<div class="image">' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $products_id), $osC_Image->show($image, $osC_Product->getTitle())) . '</div>' . '<div class="button">' . osc_link_object(osc_href_link(FILENAME_PRODUCTS, $products_id_string . '&action=cart_add'), '<i class="icon-shopping-cart icon-white"></i> ' . $osC_Language->get('button_add_to_cart'), 'class="btn btn-mini"') . '</div>'; } } $content .= '<table class="table table-hover table-striped">'; //add col groups $content .= '<colgroup>'; foreach ($cols as $col) { $content .= $col; } $content .= '</colgroup>'; //add product header $content .= '<tbody>'; $content .= '<tr class="first">'; $content .= '<th> </th>'; if (!osc_empty($products_images)) { foreach ($products_images as $k => $product_image) { $content .= '<td' . ($k == count($products_images) - 1 ? ' class="last"' : '') . '>' . $product_image . '</td>'; } } $content .= '</tr>'; $content .= '</tbody>'; //add compare details $content .= '<tbody>'; $row_class = 'even'; //add product name if (!osc_empty($products_titles)) { $content .= '<tr class="' . $row_class . '">' . '<th>' . $osC_Language->get('field_products_name') . '</th>'; foreach ($products_titles as $k => $product_title) { $content .= '<td' . ($k == count($products_titles) - 1 ? ' class="last"' : '') . '>' . $product_title . '</td>'; } $content .= '</tr>'; $row_class = $row_class == 'even' ? 'odd' : 'even'; } //add product price if (!osc_empty($products_price)) { $content .= '<tr class="' . $row_class . '">' . '<th>' . $osC_Language->get('field_products_price') . '</th>'; foreach ($products_price as $k => $product_price) { $content .= '<td' . ($k == count($products_price) - 1 ? ' class="last"' : '') . '>' . $product_price . '</td>'; } $content .= '</tr>'; $row_class = $row_class == 'even' ? 'odd' : 'even'; } //add product weight if (!osc_empty($products_weight)) { $content .= '<tr class="' . $row_class . '">' . '<th>' . $osC_Language->get('field_products_weight') . '</th>'; foreach ($products_weight as $k => $product_weight) { $content .= '<td' . ($k == count($products_weight) - 1 ? ' class="last"' : '') . '>' . $product_weight . '</td>'; } $content .= '</tr>'; $row_class = $row_class == 'even' ? 'odd' : 'even'; } //add product sku if (!osc_empty($products_sku)) { $content .= '<tr class="' . $row_class . '">' . '<th>' . $osC_Language->get('field_products_sku') . '</th>'; foreach ($products_sku as $k => $product_sku) { $content .= '<td' . ($k == count($products_sku) - 1 ? ' class="last"' : '') . '>' . $product_sku . '</td>'; } $content .= '</tr>'; $row_class = $row_class == 'even' ? 'odd' : 'even'; } //add product manufacturers if (!osc_empty($products_manufacturers)) { $content .= '<tr class="' . $row_class . '">' . '<th>' . $osC_Language->get('field_products_manufacturer') . '</th>'; foreach ($products_manufacturers as $k => $product_manufacturer) { $content .= '<td' . ($k == count($products_manufacturers) - 1 ? ' class="last"' : '') . '>' . $product_manufacturer . '</td>'; } $content .= '</tr>'; $row_class = $row_class == 'even' ? 'odd' : 'even'; } //add product variants if (!osc_empty($products_variants)) { $content .= '<tr class="' . $row_class . '">' . '<th>' . $osC_Language->get('field_products_variants') . '</th>'; foreach ($toC_Compare_Products->getProducts() as $k => $products_id_string) { if (isset($products_variants[$products_id_string]['variants']) && !osc_empty($products_variants[$products_id_string]['variants'])) { $content .= '<td' . ($k == count($toC_Compare_Products->getProducts()) - 1 ? ' class="last"' : '') . '>'; foreach ($products_variants[$products_id_string]['variants'] as $variant) { $content .= '<span class="variant label label-info">' . $variant['name'] . ': ' . $variant['value'] . '</span> '; } $content .= '</td>'; } } $content .= '</tr>'; $row_class = $row_class == 'even' ? 'odd' : 'even'; } //add product attributes if (!osc_empty($products_attributes)) { $content .= '<tr class="' . $row_class . '">' . '<th>' . $osC_Language->get('field_products_attributes') . '</th>'; foreach ($toC_Compare_Products->getProducts() as $k => $products_id_string) { if (isset($products_attributes[$products_id_string]['attributes']) && !osc_empty($products_attributes[$products_id_string]['attributes'])) { $content .= '<td' . ($k == count($toC_Compare_Products->getProducts()) - 1 ? ' class="last"' : '') . '>'; foreach ($products_attributes[$products_id_string]['attributes'] as $attribute) { $content .= '<span class="attribute">' . $attribute['name'] . ': ' . $attribute['value'] . '</span>'; } $content .= '</td>'; } } $content .= '</tr>'; $row_class = $row_class == 'even' ? 'odd' : 'even'; } //add product description if (!osc_empty($products_desciptions)) { $content .= '<tr class="' . $row_class . ' last">' . '<th>' . $osC_Language->get('field_products_description') . '</th>'; foreach ($products_desciptions as $k => $product_description) { $content .= '<td' . ($k == count($products_desciptions) - 1 ? ' class="last"' : '') . '>' . $product_description . '</td>'; } $content .= '</tr>'; $row_class = $row_class == 'even' ? 'odd' : 'even'; } $content .= '</tbody>'; $content .= '</table>'; } return $content; }