Example #1
0
function zen_get_products_quantity_mixed($product_id)
{
    global $db;
    // don't check for mixed if not attributes
    $chk_attrib = zen_has_product_attributes((int) $product_id);
    if ($chk_attrib == true) {
        $the_products_quantity_mixed = $db->Execute("select products_id, products_quantity_mixed from " . TABLE_PRODUCTS . " where products_id = '" . (int) $product_id . "'");
        if ($the_products_quantity_mixed->fields['products_quantity_mixed'] == '1') {
            $look_up = true;
        } else {
            $look_up = false;
        }
    } else {
        $look_up = 'none';
    }
    return $look_up;
}
 public static function product_cart_button($product, $product_link)
 {
     global $how_many;
     $has_attributes = zen_has_product_attributes($product->fields['products_id']);
     $hide_quantity = $product->fields['products_qty_box_status'] == 0;
     if ($has_attributes || PRODUCT_LIST_PRICE_BUY_NOW == '0') {
         $lc_button = "<a class='btn btn-default' href='{$product_link}'>" . MORE_INFO_TEXT . "</a>";
     } elseif (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0) {
         $can_add_to_cart = zen_get_products_allow_add_to_cart($product->fields['products_id']) != 'N';
         $in_stock_or_ignore_stock = $product->fields['products_quantity'] > 0 || SHOW_PRODUCTS_SOLD_OUT_IMAGE == 0;
         $not_call_for_price = $product->fields['product_is_call'] == 0;
         if (!$hide_quantity && $can_add_to_cart && $not_call_for_price && $in_stock_or_ignore_stock) {
             $how_many++;
         }
         if ($hide_quantity) {
             $buy_now_link = zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $product->fields['products_id']);
             $buy_now_button = "<button class='btn btn-primary'>" . BUTTON_BUY_NOW_ALT . "</button>";
             $lc_button = "<a href='{$buy_now_link}'>{$buy_now_button}</a>";
         } else {
             $add_to_cart_button = '<span class="input-group-btn">' . '<button class="btn btn-primary" type="submit">Add</button></span>';
             $lc_button = "<div class='input-group'>" . "<input type='text' class='form-control' name='products_id[" . "{$product->fields['products_id']}]' value='1' size='4' />" . "{$add_to_cart_button}</div>";
         }
     } elseif (PRODUCT_LIST_PRICE_BUY_NOW == '2' && !$hide_quantity) {
         $action_link = zen_href_link(zen_get_info_page($product->fields['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $product->fields['products_id']);
         $buy_now_qty = zen_get_buy_now_qty($product->fields['products_id']);
         $lc_button = zen_draw_form('cart_quantity', $action_link, 'post', 'enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . $buy_now_qty . '" ' . 'maxlength="6" size="4" />' . zen_draw_hidden_field('products_id', $product->fields['products_id']) . "<button class='btn btn-default' type='submit'>" . BUTTON_IN_CART_ALT . "</button></form>";
     } else {
         $action_link = zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $product->fields['products_id']);
         $buy_now_button = zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"');
         $lc_button = "<a class='btn btn-default' href='{$action_link}'>" . BUTTON_BUY_NOW_ALT . "</a>";
     }
     return $lc_button;
 }
Example #3
0
function zen_copy_products_attributes($products_id_from, $products_id_to)
{
    global $db;
    global $messageStack;
    global $copy_attributes_delete_first, $copy_attributes_duplicates_skipped, $copy_attributes_duplicates_overwrite, $copy_attributes_include_downloads, $copy_attributes_include_filename;
    // Check for errors in copy request
    if (!zen_has_product_attributes($products_id_from, 'false') or !zen_products_id_valid($products_id_to) or $products_id_to == $products_id_from) {
        if ($products_id_to == $products_id_from) {
            // same products_id
            $messageStack->add_session('<b>WARNING: Cannot copy from Product ID #' . $products_id_from . ' to Product ID # ' . $products_id_to . ' ... No copy was made' . '</b>', 'caution');
        } else {
            if (!zen_has_product_attributes($products_id_from, 'false')) {
                // no attributes found to copy
                $messageStack->add_session('<b>WARNING: No Attributes to copy from Product ID #' . $products_id_from . ' for: ' . zen_get_products_name($products_id_from) . ' ... No copy was made' . '</b>', 'caution');
            } else {
                // invalid products_id
                $messageStack->add_session('<b>WARNING: There is no Product ID #' . $products_id_to . ' ... No copy was made' . '</b>', 'caution');
            }
        }
    } else {
        // FIX HERE - remove once working
        // check if product already has attributes
        $check_attributes = zen_has_product_attributes($products_id_to, 'false');
        if ($copy_attributes_delete_first == '1' and $check_attributes == true) {
            // die('DELETE FIRST - Copying from ' . $products_id_from . ' to ' . $products_id_to . ' Do I delete first? ' . $copy_attributes_delete_first);
            // delete all attributes first from products_id_to
            zen_products_attributes_download_delete($products_id_to);
            $db->Execute("delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int) $products_id_to . "'");
        }
        // get attributes to copy from
        $products_copy_from = $db->Execute("select * from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id='" . (int) $products_id_from . "'" . " order by products_attributes_id");
        while (!$products_copy_from->EOF) {
            // This must match the structure of your products_attributes table
            $update_attribute = false;
            $add_attribute = true;
            $check_duplicate = $db->Execute("select * from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id='" . (int) $products_id_to . "'" . " and options_id= '" . (int) $products_copy_from->fields['options_id'] . "' and options_values_id='" . (int) $products_copy_from->fields['options_values_id'] . "'");
            if ($check_attributes == true) {
                if ($check_duplicate->RecordCount() == 0) {
                    $update_attribute = false;
                    $add_attribute = true;
                } else {
                    if ($check_duplicate->RecordCount() == 0) {
                        $update_attribute = false;
                        $add_attribute = true;
                    } else {
                        $update_attribute = true;
                        $add_attribute = false;
                    }
                }
            } else {
                $update_attribute = false;
                $add_attribute = true;
            }
            // die('UPDATE/IGNORE - Checking Copying from ' . $products_id_from . ' to ' . $products_id_to . ' Do I delete first? ' . ($copy_attributes_delete_first == '1' ? TEXT_YES : TEXT_NO) . ' Do I add? ' . ($add_attribute == true ? TEXT_YES : TEXT_NO) . ' Do I Update? ' . ($update_attribute == true ? TEXT_YES : TEXT_NO) . ' Do I skip it? ' . ($copy_attributes_duplicates_skipped=='1' ? TEXT_YES : TEXT_NO) . ' Found attributes in From: ' . $check_duplicate->RecordCount());
            if ($copy_attributes_duplicates_skipped == '1' and $check_duplicate->RecordCount() != 0) {
                // skip it
                $messageStack->add_session(TEXT_ATTRIBUTE_COPY_SKIPPING . $products_copy_from->fields['products_attributes_id'] . ' for Products ID#' . $products_id_to, 'caution');
            } else {
                if ($add_attribute == true) {
                    // New attribute - insert it
                    $db->Execute("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " (products_attributes_id, products_id, options_id, options_values_id, options_values_price, price_prefix, products_options_sort_order, product_attribute_is_free, products_attributes_weight, products_attributes_weight_prefix, attributes_display_only, attributes_default, attributes_discounted, attributes_image, attributes_price_base_included, attributes_price_onetime, attributes_price_factor, attributes_price_factor_offset, attributes_price_factor_onetime, attributes_price_factor_onetime_offset, attributes_qty_prices, attributes_qty_prices_onetime, attributes_price_words, attributes_price_words_free, attributes_price_letters, attributes_price_letters_free, attributes_required) values (0, '" . (int) $products_id_to . "',\n          '" . $products_copy_from->fields['options_id'] . "',\n          '" . $products_copy_from->fields['options_values_id'] . "',\n          '" . $products_copy_from->fields['options_values_price'] . "',\n          '" . $products_copy_from->fields['price_prefix'] . "',\n          '" . $products_copy_from->fields['products_options_sort_order'] . "',\n          '" . $products_copy_from->fields['product_attribute_is_free'] . "',\n          '" . $products_copy_from->fields['products_attributes_weight'] . "',\n          '" . $products_copy_from->fields['products_attributes_weight_prefix'] . "',\n          '" . $products_copy_from->fields['attributes_display_only'] . "',\n          '" . $products_copy_from->fields['attributes_default'] . "',\n          '" . $products_copy_from->fields['attributes_discounted'] . "',\n          '" . $products_copy_from->fields['attributes_image'] . "',\n          '" . $products_copy_from->fields['attributes_price_base_included'] . "',\n          '" . $products_copy_from->fields['attributes_price_onetime'] . "',\n          '" . $products_copy_from->fields['attributes_price_factor'] . "',\n          '" . $products_copy_from->fields['attributes_price_factor_offset'] . "',\n          '" . $products_copy_from->fields['attributes_price_factor_onetime'] . "',\n          '" . $products_copy_from->fields['attributes_price_factor_onetime_offset'] . "',\n          '" . $products_copy_from->fields['attributes_qty_prices'] . "',\n          '" . $products_copy_from->fields['attributes_qty_prices_onetime'] . "',\n          '" . $products_copy_from->fields['attributes_price_words'] . "',\n          '" . $products_copy_from->fields['attributes_price_words_free'] . "',\n          '" . $products_copy_from->fields['attributes_price_letters'] . "',\n          '" . $products_copy_from->fields['attributes_price_letters_free'] . "',\n          '" . $products_copy_from->fields['attributes_required'] . "')");
                    $messageStack->add_session(TEXT_ATTRIBUTE_COPY_INSERTING . $products_copy_from->fields['products_attributes_id'] . ' for Products ID#' . $products_id_to, 'caution');
                }
                if ($update_attribute == true) {
                    // Update attribute - Just attribute settings not ids
                    $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set\n          options_values_price='" . $products_copy_from->fields['options_values_price'] . "',\n          price_prefix='" . $products_copy_from->fields['price_prefix'] . "',\n          products_options_sort_order='" . $products_copy_from->fields['products_options_sort_order'] . "',\n          product_attribute_is_free='" . $products_copy_from->fields['product_attribute_is_free'] . "',\n          products_attributes_weight='" . $products_copy_from->fields['products_attributes_weight'] . "',\n          products_attributes_weight_prefix='" . $products_copy_from->fields['products_attributes_weight_prefix'] . "',\n          attributes_display_only='" . $products_copy_from->fields['attributes_display_only'] . "',\n          attributes_default='" . $products_copy_from->fields['attributes_default'] . "',\n          attributes_discounted='" . $products_copy_from->fields['attributes_discounted'] . "',\n          attributes_image='" . $products_copy_from->fields['attributes_image'] . "',\n          attributes_price_base_included='" . $products_copy_from->fields['attributes_price_base_included'] . "',\n          attributes_price_onetime='" . $products_copy_from->fields['attributes_price_onetime'] . "',\n          attributes_price_factor='" . $products_copy_from->fields['attributes_price_factor'] . "',\n          attributes_price_factor_offset='" . $products_copy_from->fields['attributes_price_factor_offset'] . "',\n          attributes_price_factor_onetime='" . $products_copy_from->fields['attributes_price_factor_onetime'] . "',\n          attributes_price_factor_onetime_offset='" . $products_copy_from->fields['attributes_price_factor_onetime_offset'] . "',\n          attributes_qty_prices='" . $products_copy_from->fields['attributes_qty_prices'] . "',\n          attributes_qty_prices_onetime='" . $products_copy_from->fields['attributes_qty_prices_onetime'] . "',\n          attributes_price_words='" . $products_copy_from->fields['attributes_price_words'] . "',\n          attributes_price_words_free='" . $products_copy_from->fields['attributes_price_words_free'] . "',\n          attributes_price_letters='" . $products_copy_from->fields['attributes_price_letters'] . "',\n          attributes_price_letters_free='" . $products_copy_from->fields['attributes_price_letters_free'] . "',\n          attributes_required='" . $products_copy_from->fields['attributes_required'] . "'" . " where products_id='" . (int) $products_id_to . "'" . " and options_id= '" . $products_copy_from->fields['options_id'] . "' and options_values_id='" . $products_copy_from->fields['options_values_id'] . "'");
                    //           . " where products_id='" . $products_id_to . "'" . " and options_id= '" . $products_copy_from->fields['options_id'] . "' and options_values_id='" . $products_copy_from->fields['options_values_id'] . "' and attributes_image='" . $products_copy_from->fields['attributes_image'] . "' and attributes_price_base_included='" . $products_copy_from->fields['attributes_price_base_included'] .  "'");
                    $messageStack->add_session(TEXT_ATTRIBUTE_COPY_UPDATING . $products_copy_from->fields['products_attributes_id'] . ' for Products ID#' . $products_id_to, 'caution');
                }
            }
            $products_copy_from->MoveNext();
        }
        // end of products attributes while loop
        // reset products_price_sorter for searches etc.
        zen_update_products_price_sorter($products_id_to);
    }
    // end of no attributes or other errors
}
     }
     $contents[] = array('align' => 'center', 'text' => '<br />' . zen_image_submit('button_copy.gif', IMAGE_COPY) . ' <a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
     break;
     // attribute features
 // attribute features
 case 'attribute_features':
     $copy_attributes_delete_first = '0';
     $copy_attributes_duplicates_skipped = '0';
     $copy_attributes_duplicates_overwrite = '0';
     $copy_attributes_include_downloads = '1';
     $copy_attributes_include_filename = '1';
     $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_ATTRIBUTE_FEATURES . $pInfo->products_id . '</b>');
     $contents[] = array('align' => 'center', 'text' => '<br />' . '<strong>' . TEXT_PRODUCTS_ATTRIBUTES_INFO . '</strong>' . '<br />');
     $contents[] = array('align' => 'center', 'text' => '<br />' . '<strong>' . zen_get_products_name($pInfo->products_id, $languages_id) . ' ID# ' . $pInfo->products_id . '</strong><br /><br />' . (zen_has_product_attributes($pInfo->products_id, 'false') ? '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, '&action=attributes_preview' . '&products_filter=' . $pInfo->products_id . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_preview.gif', IMAGE_PREVIEW) . '</a>' . '&nbsp;&nbsp;' : '') . '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $pInfo->products_id . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_edit_attribs.gif', IMAGE_EDIT_ATTRIBUTES) . '</a>' . '<br /><br />');
     // only if attributes
     if (zen_has_product_attributes($pInfo->products_id, 'false')) {
         $contents[] = array('align' => 'left', 'text' => '<br />' . '<strong>' . TEXT_PRODUCT_ATTRIBUTES_DOWNLOADS . '</strong>' . zen_has_product_attributes_downloads($pInfo->products_id) . zen_has_product_attributes_downloads($pInfo->products_id, true));
         $contents[] = array('align' => 'left', 'text' => '<br />' . TEXT_INFO_ATTRIBUTES_FEATURES_DELETE . '<strong>' . zen_get_products_name($pInfo->products_id) . ' ID# ' . $pInfo->products_id . '</strong><br /><a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=delete_attributes' . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . '&products_id=' . $pInfo->products_id) . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
         $contents[] = array('align' => 'left', 'text' => '<br />' . TEXT_INFO_ATTRIBUTES_FEATURES_UPDATES . '<strong>' . zen_get_products_name($pInfo->products_id, $languages_id) . ' ID# ' . $pInfo->products_id . '</strong><br /><a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=update_attributes_sort_order' . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . '&products_id=' . $pInfo->products_id) . '">' . zen_image_button('button_update.gif', IMAGE_UPDATE) . '</a>');
         $contents[] = array('align' => 'left', 'text' => '<br />' . TEXT_INFO_ATTRIBUTES_FEATURES_COPY_TO_PRODUCT . '<strong>' . zen_get_products_name($pInfo->products_id, $languages_id) . ' ID# ' . $pInfo->products_id . '</strong><br /><a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=attribute_features_copy_to_product' . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . '&products_id=' . $pInfo->products_id) . '">' . zen_image_button('button_copy_to.gif', IMAGE_COPY_TO) . '</a>');
         $contents[] = array('align' => 'left', 'text' => '<br />' . TEXT_INFO_ATTRIBUTES_FEATURES_COPY_TO_CATEGORY . '<strong>' . zen_get_products_name($pInfo->products_id, $languages_id) . ' ID# ' . $pInfo->products_id . '</strong><br /><a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=attribute_features_copy_to_category' . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . '&products_id=' . $pInfo->products_id) . '">' . zen_image_button('button_copy_to.gif', IMAGE_COPY_TO) . '</a>');
     }
     $contents[] = array('align' => 'center', 'text' => '<br /><a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
     break;
     // attribute copier to product
 // attribute copier to product
 case 'attribute_features_copy_to_product':
     $_GET['products_update_id'] = '';
     // excluded current product from the pull down menu of products
     $products_exclude_array = array();
     $products_exclude_array[] = $pInfo->products_id;
Example #5
0
     if ($_SESSION['customer_id'] && isset($_GET['products_id'])) {
         $check_query = "select count(*) as count\r\n                                                from " . TABLE_PRODUCTS_NOTIFICATIONS . "\r\n                                                where products_id = '" . $_GET['products_id'] . "'\r\n                                                and customers_id = '" . $_SESSION['customer_id'] . "'";
         $check = $db->Execute($check_query);
         if ($check->fields['count'] > 0) {
             $sql = "delete from " . TABLE_PRODUCTS_NOTIFICATIONS . "\r\n                                          where products_id = '" . $_GET['products_id'] . "'\r\n                                          and customers_id = '" . $_SESSION['customer_id'] . "'";
             $db->Execute($sql);
         }
         zen_redirect(zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action', 'main_page'))));
     } else {
         $_SESSION['navigation']->set_snapshot();
         zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
     }
     break;
 case 'cust_order':
     if ($_SESSION['customer_id'] && isset($_GET['pid'])) {
         if (zen_has_product_attributes($_GET['pid'])) {
             zen_redirect(zen_href_link(zen_get_info_page($_GET['pid']), 'products_id=' . $_GET['pid']));
         } else {
             $db->Execute("delete from " . TABLE_WISHLIST . " where products_id = '" . $_GET['pid'] . "' and customers_id = '" . $_SESSION['customer_id'] . "'");
             $_SESSION['cart']->add_cart($_GET['pid'], $_SESSION['cart']->get_quantity($_GET['pid']) + 1);
         }
     }
     zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
     break;
     // Add product to the wishlist
 // Add product to the wishlist
 case 'add_wishlist':
     if (ereg('^[0-9]+$', $_POST['products_id'])) {
         if ($_POST['products_id']) {
             $db->Execute("delete from " . TABLE_WISHLIST . " where products_id = '" . $_GET['products_id'] . "' and customers_id = '" . $_SESSION['customer_id'] . "'");
             $db->Execute("insert into " . TABLE_WISHLIST . " (customers_id, products_id, products_model, products_name, products_price) values ('" . $_SESSION['customer_id'] . "', '" . $_POST['products_id'] . "', '" . $products_model . "', '" . $products_name . "', '" . $products_price . "' )");
          <tr>
            <td class="smallText" align="center"><?php 
        echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=new_product' . '&cPath=' . zen_get_product_path($products_filter) . '&pID=' . $products_filter . '&product_type=' . zen_get_products_type($products_filter)) . '">' . zen_image_button('button_edit_product.gif', IMAGE_EDIT_PRODUCT) . '<br />' . TEXT_PRODUCT_EDIT . '</a>';
        ?>
</td>
            <td class="smallText" align="center">
              <?php 
        if ($zc_products->get_allow_add_to_cart($products_filter) == "Y") {
            echo '<a href="' . zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_products_price_manager.gif', IMAGE_PRODUCTS_PRICE_MANAGER) . '<br />' . TEXT_PRODUCTS_PRICE_MANAGER . '</a>';
        } else {
            echo TEXT_INFO_ALLOW_ADD_TO_CART_NO;
        }
        ?>
            </td>
<?php 
        if (zen_has_product_attributes($products_filter, 'false')) {
            ?>
            <td class="smallText" align="center"><?php 
            echo zen_draw_form('update_sort', FILENAME_ATTRIBUTES_CONTROLLER, 'action=update_attribute_sort' . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id);
            echo zen_image_submit('button_update_sort.gif', IMAGE_UPDATE_SORT);
            echo zen_draw_hidden_field('confirm', 'y');
            ?>
</form><br /><?php 
            echo TEXT_ATTRIBUTES_UPDATE_SORT_ORDER;
            ?>
</td>
            <td class="smallText" align="center"><?php 
            echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, '&action=attributes_preview' . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_preview.gif', IMAGE_PREVIEW) . '<br />' . TEXT_ATTRIBUTES_PREVIEW . '</a>';
            ?>
</td>
            <td class="smallText" align="center"><?php 
            echo $quantityDiscount['discount'];
            ?>
</td><?php 
        }
        $disc_cnt++;
        if ($discount_col_cnt == $disc_cnt && !($key == sizeof($quantityDiscount))) {
            $disc_cnt = 0;
            ?>
  </tr>
<?php 
        }
    }
    ?>

<?php 
    if (zen_has_product_attributes($products_id_current)) {
        ?>
    <tr>
      <td colspan="<?php 
        echo $columnCount + 1;
        ?>
" align="center">
        <?php 
        echo TEXT_FOOTER_DISCOUNT_QUANTITIES;
        ?>
      </td>
    </tr>
<?php 
    }
    ?>
  </table>
 /**
  * Method to handle cart Action - Customer Order
  *
  * @param string forward destination
  * @param url parameters
  */
 function actionCustomerOrder($goto, $parameters)
 {
     global $zco_page;
     if ($_SESSION['customer_id'] && isset($_GET['pid'])) {
         if (zen_has_product_attributes($_GET['pid'])) {
             zen_redirect(zen_href_link(zen_get_info_page($_GET['pid']), 'products_id=' . $_GET['pid']));
         } else {
             $this->add_cart($_GET['pid'], $this->get_quantity($_GET['pid']) + 1);
         }
     }
     zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
 }
     $display_products_date_added = '';
 }
 if (PRODUCT_FEATURED_LIST_MANUFACTURER != '0' and zen_get_show_product_switch($featured_products->fields['products_id'], 'manufacturer')) {
     $display_products_manufacturers_name = $featured_products->fields['manufacturers_name'] != '' ? TEXT_MANUFACTURER . ' ' . $featured_products->fields['manufacturers_name'] . str_repeat('<br clear="all" />', substr(PRODUCT_FEATURED_LIST_MANUFACTURER, 3, 1)) : '';
 } else {
     $display_products_manufacturers_name = '';
 }
 if (PRODUCT_FEATURED_LIST_PRICE != '0' and zen_get_products_allow_add_to_cart($featured_products->fields['products_id']) == 'Y' and zen_check_show_prices() == true) {
     $products_price = zen_get_products_display_price($featured_products->fields['products_id']);
     $display_products_price = TEXT_PRICE . ' ' . $products_price . str_repeat('<br clear="all" />', substr(PRODUCT_FEATURED_LIST_PRICE, 3, 1)) . (zen_get_show_product_switch($featured_products->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? zen_get_product_is_always_free_shipping($featured_products->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '' : '');
 } else {
     $display_products_price = '';
 }
 // more info in place of buy now
 if (PRODUCT_FEATURED_BUY_NOW != '0' and zen_get_products_allow_add_to_cart($featured_products->fields['products_id']) == 'Y') {
     if (zen_has_product_attributes($featured_products->fields['products_id'])) {
         $link = '<a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($featured_products->fields['master_categories_id']) . '&products_id=' . $featured_products->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
     } else {
         //          $link= '<a href="' . zen_href_link(FILENAME_FEATURED_PRODUCTS, zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</a>';
         if (PRODUCT_FEATURED_LISTING_MULTIPLE_ADD_TO_CART > 0 && $featured_products->fields['products_qty_box_status'] != 0) {
             //            $how_many++;
             $link = TEXT_PRODUCT_FEATURED_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" name=\"products_id[" . $featured_products->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
         } else {
             $link = '<a href="' . zen_href_link(FILENAME_FEATURED_PRODUCTS, zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT) . '</a>&nbsp;';
         }
     }
     $the_button = $link;
     $products_link = '<a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($featured_products->fields['master_categories_id']) . '&products_id=' . $featured_products->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
     $display_products_button = zen_get_buy_now_button($featured_products->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($featured_products->fields['products_id']) . str_repeat('<br clear="all" />', substr(PRODUCT_FEATURED_BUY_NOW, 3, 1));
 } else {
     $link = '<a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($featured_products->fields['master_categories_id']) . '&products_id=' . $featured_products->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
Example #10
0
     // add description
     if (PRODUCT_LIST_DESCRIPTION > 0) {
         $lc_text .= '<div>' . zen_trunc_string(zen_clean_html(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id'])), PRODUCT_LIST_DESCRIPTION) . '</div>';
     }
     break;
 case 'PRODUCT_LIST_MANUFACTURER':
     $lc_align = '';
     $lc_text = '&nbsp;<a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing->fields['manufacturers_id']) . '">' . $listing->fields['manufacturers_name'] . '</a>&nbsp;';
     break;
 case 'PRODUCT_LIST_PRICE':
     $lc_price = CommerceProduct::getDisplayPriceFromHash($listing->fields['products_id']) . '<br />';
     $lc_align = 'right';
     $lc_text = '&nbsp;' . $lc_price . '&nbsp;';
     // more info in place of buy now
     $lc_button = '';
     if ($listing->fields['products_priced_by_attribute'] || PRODUCT_LIST_PRICE_BUY_NOW == '0' || zen_has_product_attributes($listing->fields['products_id'])) {
         $lc_button = '<a href="' . CommerceProduct::getDisplayUrlFromId($listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
     } else {
         if (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0) {
             $how_many++;
             $lc_button = TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" name=\"products_id[" . $listing->fields['products_id'] . "]\" value=0 size=\"4\">";
         } else {
             $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT) . '</a>&nbsp;';
         }
     }
     $the_button = $lc_button;
     $products_link = '<a href="' . CommerceProduct::getDisplayUrlFromId($listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
     $lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
     break;
 case 'PRODUCT_LIST_QUANTITY':
     $lc_align = 'right';
function eo_get_new_product($product_id, $product_qty = 1, $product_options = array(), $use_specials = true)
{
    global $db;
    $product_id = (int) $product_id;
    $product_qty = (double) $product_qty;
    $retval = array('id' => $product_id, 'qty' => $product_qty);
    $query = $db->Execute('SELECT `p`.`products_id`, `p`.`master_categories_id`, `p`.`products_status`, ' . '`pd`.`products_name`, `p`.`products_model`, `p`.`products_image`, `p`.`products_price`, ' . '`p`.`products_weight`, `p`.`products_tax_class_id`, `p`.`manufacturers_id`, ' . '`p`.`products_quantity_order_min`, `p`.`products_quantity_order_units`, ' . '`p`.`products_quantity_order_max`, `p`.`product_is_free`, `p`.`products_virtual`, ' . '`p`.`products_discount_type`, `p`.`products_discount_type_from`, ' . '`p`.`products_priced_by_attribute`, `p`.`product_is_always_free_shipping` ' . 'FROM `' . TABLE_PRODUCTS . '` AS `p`, `' . TABLE_PRODUCTS_DESCRIPTION . '` AS `pd` ' . 'WHERE `p`.`products_id`=\'' . (int) $product_id . '\' ' . 'AND `pd`.`products_id`=`p`.`products_id` ' . 'AND `pd`.`language_id`=\'' . (int) $_SESSION['languages_id'] . '\'');
    if (!$query->EOF) {
        // Handle common fields
        $retval = array_merge($retval, array('name' => $query->fields['products_name'], 'model' => $query->fields['products_model'], 'price' => $query->fields['products_price'], 'products_discount_type' => $query->fields['products_discount_type'], 'products_discount_type_from' => $query->fields['products_discount_type_from'], 'products_priced_by_attribute' => $query->fields['products_priced_by_attribute'], 'product_is_free' => $query->fields['product_is_free'], 'products_virtual' => $query->fields['products_virtual'], 'product_is_always_free_shipping' => $query->fields['product_is_always_free_shipping'], 'tax' => number_format(zen_get_tax_rate_value($query->fields['products_tax_class_id']), 4), 'tax_description' => zen_get_tax_description($query->fields['products_tax_class_id'])));
        // Handle pricing
        $special_price = zen_get_products_special_price($product_id);
        if ($use_specials && $special_price && $retval['products_priced_by_attribute'] == 0) {
            $retval['price'] = $special_price;
        } else {
            $special_price = 0;
        }
        if (zen_get_products_price_is_free($product_id)) {
            // no charge
            $retval['price'] = 0;
        }
        // adjust price for discounts when priced by attribute
        if ($retval['products_priced_by_attribute'] == '1' && zen_has_product_attributes($product_id, 'false')) {
            // reset for priced by attributes
            if ($special_price) {
                $retval['price'] = $special_price;
            } else {
                $retval['price'] = $query->fields['products_price'];
                // START MARKUP
                if (isset($GLOBALS['priceMarkup'])) {
                    $retval['price'] = $GLOBALS['priceMarkup']->calculatePrice($product_id, $query->fields['manufacturers_id'], $query->fields['master_categories_id'], $retval['price']);
                }
                // END MARKUP
            }
        } else {
            // discount qty pricing
            if ($retval['products_discount_type'] != '0') {
                $retval['price'] = zen_get_products_discount_price_qty($product_id, $retval['qty']);
            }
            // START MARKUP
            if (isset($GLOBALS['priceMarkup'])) {
                $retval['price'] = $GLOBALS['priceMarkup']->calculatePrice($product_id, $query->fields['manufacturers_id'], $query->fields['master_categories_id'], $retval['price']);
            }
            // END MARKUP
        }
        unset($special_price);
        $retval['onetime_charges'] = 0;
        $retval['final_price'] = $retval['price'];
    }
    // Handle attributes
    if (is_array($product_options) && count($product_options > 0)) {
        $retval['attributes'] = array();
        include_once DIR_WS_CLASSES . 'attributes.php';
        $attributes = new attributes();
        foreach ($product_options as $option_id => $details) {
            $attr = array();
            switch ($details['type']) {
                case PRODUCTS_OPTIONS_TYPE_TEXT:
                case PRODUCTS_OPTIONS_TYPE_FILE:
                    $attr['option_id'] = $option_id;
                    $attr['value'] = $details['value'];
                    if ($attr['value'] == '') {
                        continue 2;
                    }
                    // There should only be one text per name.....
                    $get_attr_id = $attributes->get_attributes_by_option($product_id, $option_id);
                    if (count($get_attr_id) == 1) {
                        $details['value'] = $get_attr_id[0]['products_attributes_id'];
                    }
                    unset($get_attr_id);
                    break;
                case PRODUCTS_OPTIONS_TYPE_CHECKBOX:
                    if (!array_key_exists('value', $details)) {
                        continue 2;
                    }
                    $tmp_id = array_shift($details['value']);
                    foreach ($details['value'] as $attribute_id) {
                        // We only get here if more than one checkbox per
                        // option was selected.
                        $tmp = $attributes->get_attribute_by_id($attribute_id, 'order');
                        $retval['attributes'][] = $tmp;
                        // Handle pricing
                        $prices = eo_get_product_attribute_prices($attribute_id, $tmp['value'], $product_qty);
                        unset($tmp);
                        if (!$query->EOF) {
                            $retval['onetime_charges'] += $prices['onetime_charges'];
                            $retval['final_price'] += $prices['price'];
                        }
                    }
                    $details['value'] = $tmp_id;
                    $attr = $attributes->get_attribute_by_id($details['value'], 'order');
                    unset($attribute_id);
                    unset($attribute_value);
                    unset($tmp_id);
                    break;
                default:
                    $attr = $attributes->get_attribute_by_id($details['value'], 'order');
            }
            $retval['attributes'][] = $attr;
            if (!$query->EOF) {
                // Handle pricing
                $prices = eo_get_product_attribute_prices($details['value'], $attr['value'], $product_qty);
                $retval['onetime_charges'] += $prices['onetime_charges'];
                $retval['final_price'] += $prices['price'];
            }
        }
        unset($query, $attr, $prices, $option_id, $details);
    }
    return $retval;
}
 }
 if (PRODUCT_SPECIALS_MANUFACTURER != '0' and zen_get_show_product_switch($specials->fields['products_id'], 'manufacturer')) {
     $display_products_manufacturers_name = $specials->fields['manufacturers_name'] != '' ? TEXT_MANUFACTURER . ' ' . $specials->fields['manufacturers_name'] . str_repeat('', substr(PRODUCT_SPECIALS_MANUFACTURER, 3, 1)) : '';
 } else {
     $display_products_manufacturers_name = '';
 }
 if (PRODUCT_SPECIALS_PRICE != '0' and zen_get_products_allow_add_to_cart($specials->fields['products_id']) == 'Y' and zen_check_show_prices() == true) {
     $products_price = zen_mb_get_products_display_price($specials->fields['products_id']);
     $display_products_price = TEXT_PRICE . ' ' . $products_price . str_repeat('', substr(PRODUCT_SPECIALS_PRICE, 3, 1)) . (zen_get_show_product_switch($specials->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? zen_get_product_is_always_free_shipping($specials->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '' : '');
 } else {
     $display_products_price = '';
     $products_price = '';
 }
 // more info in place of buy now
 if (PRODUCT_NEW_BUY_NOW != '0' and zen_get_products_allow_add_to_cart($specials->fields['products_id']) == 'Y') {
     if (zen_has_product_attributes($specials->fields['products_id'])) {
         $link = '<a href="' . zen_href_link(zen_get_info_page($specials->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($specials->fields['master_categories_id']) . '&products_id=' . $specials->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
     } else {
         if (PRODUCT_SPECIALS_MULTIPLE_ADD_TO_CART > 0 && $specials->fields['products_qty_box_status'] != 0) {
             //            $how_many++;
             $link = '<span>' . TEXT_PRODUCT_SPECIALS_MULTIPLE_ADD_TO_CART . "</span><input class='input-text' type=\"text\" name=\"products_id[" . $specials->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
         } else {
             $link = '<a href="' . zen_href_link(FILENAME_SPECIALS, zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $specials->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT) . '</a>&nbsp;';
         }
     }
     $the_button = $link;
     $products_link = '<a href="' . zen_href_link(zen_get_info_page($specials->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($specials->fields['master_categories_id']) . '&products_id=' . $specials->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
     $display_products_button = zen_get_buy_now_button($specials->fields['products_id'], $the_button, $products_link) . zen_get_products_quantity_min_units_display($specials->fields['products_id']) . str_repeat('', substr(PRODUCT_NEW_BUY_NOW, 3, 1));
 } else {
     $link = '<a href="' . zen_href_link(zen_get_info_page($specials->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($specials->fields['master_categories_id']) . '&products_id=' . $specials->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
     $the_button = $link;
         $result->MoveNext();
     }
     $ProductOptions = str_replace('value="' . $add_product_products_id . '"', 'value="' . $add_product_products_id . '" selected', $ProductOptions);
     echo $ProductOptions;
     unset($ProductOptions);
     echo "</select></td>\n";
     echo "<input type='hidden' name='add_product_categories_id' value='{$add_product_categories_id}'>";
     echo "<input type='hidden' name='search' value='" . $_POST['search'] . "'>";
     echo "<input type='hidden' name='step' value='3'>";
     echo "</form></tr>\n";
     echo "<tr><td colspan='3'>&nbsp;</td></tr>\n";
 }
 // Step 3: Choose Options
 if ($step > 2 && $add_product_products_id > 0) {
     // Skip to Step 4 if no Options
     if (!zen_has_product_attributes($add_product_products_id)) {
         echo "<tr class=\"dataTableRow\">\n";
         echo "<td class='dataTableContent' align='right'><strong>" . ADDPRODUCT_TEXT_STEP3 . "</strong></td><td class='dataTableContent' valign='top' colspan='2'><i>" . ADDPRODUCT_TEXT_OPTIONS_NOTEXIST . "</i></td>";
         echo "</tr>\n";
         $step = 4;
     } else {
         $attrs = eo_get_product_attributes_options($add_product_products_id);
         echo "<tr class='dataTableRow'>" . zen_draw_form('add_prdct', FILENAME_EDIT_ORDERS, zen_get_all_get_params(array('action', 'oID')) . 'oID=' . $oID . '&action=add_prdct', 'post', '', true);
         echo "<td class='dataTableContent' align='right'><strong>" . ADDPRODUCT_TEXT_STEP3 . "</strong></td><td class='dataTableContent' valign='top'>";
         foreach ($attrs as $optionID => $optionInfo) {
             switch ($optionInfo['type']) {
                 case PRODUCTS_OPTIONS_TYPE_ATTRIBUTE_GRID:
                 case PRODUCTS_OPTIONS_TYPE_RADIO:
                 case PRODUCTS_OPTIONS_TYPE_SELECT:
                     echo '<label class="attribsSelect" for="attrib-' . $optionID . '">' . $optionInfo['name'] . '</label>';
                     $products_options_array = array();
Example #14
0
 function get_products($check_for_valid_cart = false)
 {
     global $db;
     if (!is_array($this->contents)) {
         return false;
     }
     $products_array = array();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         $products_query = "select p.products_id, pd.products_name, p.products_model, p.products_image,\r\n                                  p.products_price, p.products_weight, p.products_tax_class_id,\r\n                                  p.products_quantity_order_min, p.products_quantity_order_units,\r\n                                  p.product_is_free, p.products_priced_by_attribute,\r\n                                  p.products_discount_type, p.products_discount_type_from\r\n                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd\r\n                           where p.products_id = '" . (int) $products_id . "'\r\n                           and pd.products_id = p.products_id\r\n                           and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'";
         if ($products = $db->Execute($products_query)) {
             $prid = $products->fields['products_id'];
             $products_price = $products->fields['products_price'];
             //fix here
             /*
                       $special_price = zen_get_products_special_price($prid);
                       if ($special_price) {
                         $products_price = $special_price;
                       }
             */
             $special_price = zen_get_products_special_price($prid);
             if ($special_price and $products->fields['products_priced_by_attribute'] == 0) {
                 $products_price = $special_price;
             } else {
                 $special_price = 0;
             }
             if (zen_get_products_price_is_free($products->fields['products_id'])) {
                 // no charge
                 $products_price = 0;
             }
             // adjust price for discounts when priced by attribute
             if ($products->fields['products_priced_by_attribute'] == '1' and zen_has_product_attributes($products->fields['products_id'], 'false')) {
                 // reset for priced by attributes
                 //            $products_price = $products->fields['products_price'];
                 if ($special_price) {
                     $products_price = $special_price;
                 } else {
                     $products_price = $products->fields['products_price'];
                 }
             } else {
                 // discount qty pricing
                 if ($products->fields['products_discount_type'] != '0') {
                     $products_price = zen_get_products_discount_price_qty($products->fields['products_id'], $this->contents[$products_id]['qty']);
                 }
             }
             if ($check_for_valid_cart == true) {
                 $check_quantity = $this->contents[$products_id]['qty'];
                 $check_quantity_min = $products->fields['products_quantity_order_min'];
                 // Check quantity min
                 if ($new_check_quantity = $this->in_cart_mixed($prid)) {
                     $check_quantity = $new_check_quantity;
                 }
                 $fix_once = 0;
                 if ($check_quantity < $check_quantity_min) {
                     $fix_once++;
                     $_SESSION['valid_to_checkout'] = false;
                     $_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_MIN_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
                 }
                 // Check Quantity Units if not already an error on Quantity Minimum
                 if ($fix_once == 0) {
                     $check_units = $products->fields['products_quantity_order_units'];
                     if (fmod_round($check_quantity, $check_units) != 0) {
                         $_SESSION['valid_to_checkout'] = false;
                         $_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_UNITS_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
                     }
                 }
                 // Verify Valid Attributes
             }
             //clr 030714 update $products_array to include attribute value_text. This is needed for text attributes.
             // convert quantity to proper decimals
             if (QUANTITY_DECIMALS != 0) {
                 //          $new_qty = round($new_qty, QUANTITY_DECIMALS);
                 $fix_qty = $this->contents[$products_id]['qty'];
                 switch (true) {
                     case !strstr($fix_qty, '.'):
                         $new_qty = $fix_qty;
                         break;
                     default:
                         $new_qty = preg_replace('/[0]+$/', '', $this->contents[$products_id]['qty']);
                         break;
                 }
             } else {
                 $new_qty = $this->contents[$products_id]['qty'];
             }
             $new_qty = round($new_qty, QUANTITY_DECIMALS);
             if ($new_qty == (int) $new_qty) {
                 $new_qty = (int) $new_qty;
             }
             $products_array[] = array('id' => $products_id, 'name' => $products->fields['products_name'], 'model' => $products->fields['products_model'], 'image' => $products->fields['products_image'], 'price' => $products->fields['product_is_free'] == '1' ? 0 : $products_price, 'quantity' => $new_qty, 'weight' => $products->fields['products_weight'] + $this->attributes_weight($products_id), 'final_price' => $products_price + $this->attributes_price($products_id), 'onetime_charges' => $this->attributes_price_onetime_charges($products_id, $new_qty), 'tax_class_id' => $products->fields['products_tax_class_id'], 'attributes' => isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '', 'attributes_values' => $this->contents[$products_id]['attributes_values'], 'products_priced_by_attribute' => $products->fields['products_priced_by_attribute'], 'product_is_free' => $products->fields['product_is_free'], 'products_discount_type' => $products->fields['products_discount_type'], 'products_discount_type_from' => $products->fields['products_discount_type_from']);
         }
     }
     return $products_array;
 }
             <td class="dataTableContent" align="right">
     <?php 
     echo '<a href="' . zen_href_link($type_handler, 'cPath=' . $cPath . '&product_type=' . $products->fields['products_type'] . '&pID=' . $products->fields['products_id'] . '&action=new_product' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '</a>';
     ?>
     <?php 
     echo '<a href="' . zen_href_link($type_handler, 'cPath=' . $cPath . '&product_type=' . $products->fields['products_type'] . '&pID=' . $products->fields['products_id'] . '&action=delete_product') . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . '</a>';
     ?>
     <?php 
     echo '<a href="' . zen_href_link($type_handler, 'cPath=' . $cPath . '&product_type=' . $products->fields['products_type'] . '&pID=' . $products->fields['products_id'] . '&action=move_product') . '">' . zen_image(DIR_WS_IMAGES . 'icon_move.gif', ICON_MOVE) . '</a>';
     ?>
     <?php 
     echo '<a href="' . zen_href_link($type_handler, 'cPath=' . $cPath . '&product_type=' . $products->fields['products_type'] . '&pID=' . $products->fields['products_id'] . '&action=copy_to') . '">' . zen_image(DIR_WS_IMAGES . 'icon_copy_to.gif', ICON_COPY_TO) . '</a>';
     // BOF: Attribute commands
     //if (!empty($products->fields['products_id']) && zen_has_product_attributes($products->fields['products_id'], 'false')) {
     if (zen_has_product_attributes($products->fields['products_id'], 'false')) {
         echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products->fields['products_id'] . '&action=attribute_features' . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . (!empty($products->fields['products_id']) && zen_has_product_attributes($products->fields['products_id'], 'false') ? zen_image(DIR_WS_IMAGES . 'icon_attributes_on.gif', ICON_ATTRIBUTES) : zen_image(DIR_WS_IMAGES . 'icon_attributes.gif', ICON_ATTRIBUTES)) . '</a>';
     } else {
         echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products->fields['products_id'] . '&current_category_id=' . $current_category_id) . '">' . zen_image(DIR_WS_IMAGES . 'icon_attributes.gif', ICON_ATTRIBUTES) . '</a>';
     }
     //} // EOF: Attribute commands
     if ($zc_products->get_allow_add_to_cart($products->fields['products_id']) == "Y") {
         echo '<a href="' . zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $products->fields['products_id'] . '&current_category_id=' . $current_category_id) . '">' . zen_image(DIR_WS_IMAGES . 'icon_products_price_manager.gif', ICON_PRODUCTS_PRICE_MANAGER) . '</a>';
     }
     // meta tags
     if (zen_get_metatags_keywords($products->fields['products_id'], (int) $_SESSION['languages_id']) or zen_get_metatags_description($products->fields['products_id'], (int) $_SESSION['languages_id'])) {
         echo ' <a href="' . zen_href_link($type_handler, 'page=' . $_GET['page'] . '&product_type=' . $products->fields['products_type'] . '&cPath=' . $cPath . '&pID=' . $products->fields['products_id'] . '&action=new_product_meta_tags') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit_metatags_on.gif', ICON_METATAGS_ON) . '</a>';
     } else {
         echo ' <a href="' . zen_href_link($type_handler, 'page=' . $_GET['page'] . '&product_type=' . $products->fields['products_type'] . '&cPath=' . $cPath . '&pID=' . $products->fields['products_id'] . '&action=new_product_meta_tags') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit_metatags_off.gif', ICON_METATAGS_OFF) . '</a>';
     }
 }
 // action == ''
    /**
     * require the image display code
     */
    ?>
<div id="reviewsInfoDefaultProductImage" class="centeredContent back"><?php 
    require $template->get_template_dir('/tpl_modules_main_product_image.php', DIR_WS_TEMPLATE, $current_page_base, 'templates') . '/tpl_modules_main_product_image.php';
    ?>
</div>
<?php 
}
?>
<div class="forward">
<div class="buttonRow">
<?php 
// more info in place of buy now
if (zen_has_product_attributes($review_info->fields['products_id'])) {
    //   $link = '<p>' . '<a href="' . zen_href_link(zen_get_info_page($review_info->fields['products_id']), 'products_id=' . $review_info->fields['products_id'] ) . '">' . MORE_INFO_TEXT . '</a>' . '</p>';
    $link = '';
} else {
    $link = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action', 'reviews_id')) . 'action=buy_now') . '">' . zen_image_button(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</a>';
}
$the_button = $link;
$products_link = '';
echo zen_get_buy_now_button($review_info->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($review_info->fields['products_id']);
?>
</div>
<div id="reviewsInfoDefaultProductPageLink" class="buttonRow"><?php 
echo '<a href="' . zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('reviews_id'))) . '">' . zen_image_button(BUTTON_IMAGE_GOTO_PROD_DETAILS, BUTTON_GOTO_PROD_DETAILS_ALT) . '</a>';
?>
</div>
$show_submit = zen_run_normal();
// check whether to use multiple-add-to-cart, and whether top or bottom buttons are displayed
if (PRODUCT_ALL_LISTING_MULTIPLE_ADD_TO_CART > 0 and $show_submit == true and $products_all_split->number_of_rows > 0) {
    // check how many rows
    $check_products_all = $db->Execute($products_all_split->sql_query);
    $how_many = 0;
    while (!$check_products_all->EOF) {
        if (zen_has_product_attributes($check_products_all->fields['products_id'])) {
        } else {
            // needs a better check v1.3.1
            if ($check_products_all->fields['products_qty_box_status'] != 0) {
                if (zen_get_products_allow_add_to_cart($check_products_all->fields['products_id']) != 'N') {
                    if ($check_products_all->fields['product_is_call'] == 0) {
                        if (SHOW_PRODUCTS_SOLD_OUT_IMAGE == 1 and $check_products_all->fields['products_quantity'] > 0 or SHOW_PRODUCTS_SOLD_OUT_IMAGE == 0) {
                            if ($check_products_all->fields['products_type'] != 3) {
                                if (zen_has_product_attributes($check_products_all->fields['products_id']) < 1) {
                                    $how_many++;
                                }
                            }
                        }
                    }
                }
            }
        }
        $check_products_all->MoveNext();
    }
    if ($how_many > 0 and $show_submit == true and $products_all_split->number_of_rows > 0 and (PRODUCT_ALL_LISTING_MULTIPLE_ADD_TO_CART == 1 or PRODUCT_ALL_LISTING_MULTIPLE_ADD_TO_CART == 3)) {
        $show_top_submit_button = true;
    } else {
        $show_top_submit_button = false;
    }
 /**
  * Method to handle cart Action - Customer Order
  *
  * @param string forward destination
  * @param url parameters
  */
 function actionCustomerOrder($goto, $parameters)
 {
     global $zco_page;
     global $messageStack;
     if ($_SESSION['customer_id'] && isset($_GET['pid'])) {
         if (zen_has_product_attributes($_GET['pid'])) {
             zen_redirect(zen_href_link(zen_get_info_page($_GET['pid']), 'products_id=' . $_GET['pid']));
         } else {
             $this->add_cart($_GET['pid'], $this->get_quantity($_GET['pid']) + 1);
         }
     }
     // display message if all is good and not on shopping_cart page
     if (DISPLAY_CART == 'false' && $_GET['main_page'] != FILENAME_SHOPPING_CART) {
         $messageStack->add_session('header', SUCCESS_ADDED_TO_CART_PRODUCT, 'success');
     }
     zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
 }
Example #19
0
         $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
     } else {
         $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
     }
     break;
 case 'PRODUCT_LIST_MANUFACTURER':
     $lc_align = '';
     $lc_text = '<a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing->fields['manufacturers_id']) . '">' . $listing->fields['manufacturers_name'] . '</a>';
     break;
 case 'PRODUCT_LIST_PRICE':
     $lc_price = '<span class="table-price">' . zen_get_products_display_price($listing->fields['products_id']) . '</span><br />';
     $lc_align = 'right';
     $lc_text = $lc_price;
     // more info in place of buy now
     $lc_button = '';
     if (zen_has_product_attributes($listing->fields['products_id']) or PRODUCT_LIST_PRICE_BUY_NOW == '0') {
         $lc_button = '<span class="more-info"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? $_GET['cPath'] : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a></span>';
     } else {
         if (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0) {
             if ($listing->fields['products_qty_box_status'] != 0 && zen_get_products_allow_add_to_cart($listing->fields['products_id']) != 'N' && $listing->fields['product_is_call'] == 0 && ($listing->fields['products_quantity'] > 0 || SHOW_PRODUCTS_SOLD_OUT_IMAGE == 0)) {
                 $how_many++;
             }
             // hide quantity box
             if ($listing->fields['products_qty_box_status'] == 0) {
                 $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
             } else {
                 $lc_button = TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" name=\"products_id[" . $listing->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
             }
         } else {
             // qty box with add to cart button
             if (PRODUCT_LIST_PRICE_BUY_NOW == '2' && $listing->fields['products_qty_box_status'] != 0) {
Example #20
0
 /**
  * Method to handle cart Action - Customer Order
  *
  * @param string forward destination
  * @param url parameters
  */
 public function actionCustomerOrder($goto, $parameters)
 {
     if ($this->getSessionVar('customer_id') && isset($_GET['pid'])) {
         if (zen_has_product_attributes($_GET['pid'])) {
             zen_redirect(zen_href_link(zen_get_info_page($_GET['pid']), 'products_id=' . $_GET['pid']));
         } else {
             $this->add_cart($_GET['pid'], $this->get_quantity($_GET['pid']) + 1);
         }
     }
     // display message if all is good and not on shopping_cart page
     if (DISPLAY_CART == 'false' && $this->getMainPage() != 'shopping_cart') {
         $this->getMessageStack()->add_session('header', SUCCESS_ADDED_TO_CART_PRODUCT, 'success');
     }
     zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
 }
 /**
  * Method to handle cart Action - Customer Order
  *
  * @param string forward destination
  * @param url parameters
  */
 function actionCustomerOrder($goto, $parameters)
 {
     global $zco_page, $messageStack;
     if ($this->display_debug_messages) {
         $messageStack->add_session('header', 'FUNCTION ' . __FUNCTION__, 'caution');
     }
     if ($_SESSION['customer_id'] && isset($_GET['pid'])) {
         if (zen_has_product_attributes($_GET['pid'])) {
             zen_redirect(zen_href_link(zen_get_info_page($_GET['pid']), 'products_id=' . $_GET['pid']));
         } else {
             $this->add_cart($_GET['pid'], $this->get_quantity($_GET['pid']) + 1);
         }
     }
     // display message if all is good and not on shopping_cart page
     if (DISPLAY_CART == 'false' && $_GET['main_page'] != FILENAME_SHOPPING_CART && $messageStack->size('shopping_cart') == 0) {
         $messageStack->add_session('header', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . SUCCESS_ADDED_TO_CART_PRODUCTS, 'success');
     } else {
         if (DISPLAY_CART == 'false') {
             zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
         }
     }
     zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
 }
 function get_product_cart_button($fields)
 {
     $cart_button = "";
     $products_id = (int) $fields['products_id'];
     if (zen_has_product_attributes($products_id) or PRODUCT_LIST_PRICE_BUY_NOW == '0') {
         // オプション属性があったら、購入ボタンではなく詳細画面のリンクにする
         $cart_button = '<a href="' . $fields['url'] . '">' . MORE_INFO_TEXT . '</a>';
     } else {
         if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
             // do nothing
         } else {
             $flag_show_product_info_in_cart_qty = zen_get_show_product_switch($products_id, 'in_cart_qty');
             $display_qty = ($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($products_id)) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($products_id) . '</p>' : '';
             if ($fields['products_qty_box_status'] == 0 or $fields['products_quantity_order_max'] == 1) {
                 // hide the quantity box and default to 1
                 $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', $products_id) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
             } else {
                 // show the quantity box
                 $the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . zen_get_buy_now_qty($products_id) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display($products_id) . '<br />' . zen_draw_hidden_field('products_id', $products_id) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
             }
             $display_button = zen_get_buy_now_button($products_id, $the_button);
             if ($display_qty != '' or $display_button != '') {
                 $cart_button = zen_draw_form('cart_quantity_' . $products_id, zen_href_link(zen_get_info_page($products_id), zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"');
                 $cart_button .= '<div>';
                 $cart_button .= $display_qty;
                 $cart_button .= $display_button;
                 $cart_button .= '</div>';
                 $cart_button .= '</form>';
             }
         }
     }
     return $cart_button;
 }
     $display_products_date_added = '';
 }
 if (PRODUCT_NEW_LIST_MANUFACTURER != '0' and zen_get_show_product_switch($products_new->fields['products_id'], 'manufacturer')) {
     $display_products_manufacturers_name = $products_new->fields['manufacturers_name'] != '' ? TEXT_MANUFACTURER . ' ' . $products_new->fields['manufacturers_name'] . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_LIST_MANUFACTURER, 3, 1)) : '';
 } else {
     $display_products_manufacturers_name = '';
 }
 if (PRODUCT_NEW_LIST_PRICE != '0' and zen_get_products_allow_add_to_cart($products_new->fields['products_id']) == 'Y' and zen_check_show_prices() == true) {
     $products_price = zen_get_products_display_price($products_new->fields['products_id']);
     $display_products_price = TEXT_PRICE . ' ' . $products_price . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_LIST_PRICE, 3, 1)) . (zen_get_show_product_switch($products_new->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? zen_get_product_is_always_free_shipping($products_new->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '' : '');
 } else {
     $display_products_price = '';
 }
 // more info in place of buy now
 if (PRODUCT_NEW_BUY_NOW != '0' and zen_get_products_allow_add_to_cart($products_new->fields['products_id']) == 'Y') {
     if (zen_has_product_attributes($products_new->fields['products_id'])) {
         $link = '<a href="' . zen_href_link(zen_get_info_page($products_new->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_new->fields['master_categories_id']) . '&products_id=' . $products_new->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
     } else {
         //          $link= '<a href="' . zen_href_link(FILENAME_PRODUCTS_NEW, zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</a>';
         if (PRODUCT_NEW_LISTING_MULTIPLE_ADD_TO_CART > 0 && $products_new->fields['products_qty_box_status'] != 0) {
             //            $how_many++;
             $link = TEXT_PRODUCT_NEW_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" name=\"products_id[" . $products_new->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
         } else {
             $link = '<a href="' . zen_href_link(FILENAME_PRODUCTS_NEW, zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT) . '</a>&nbsp;';
         }
     }
     $the_button = $link;
     $products_link = '<a href="' . zen_href_link(zen_get_info_page($products_new->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_new->fields['master_categories_id']) . '&products_id=' . $products_new->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
     $display_products_button = zen_get_buy_now_button($products_new->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($products_new->fields['products_id']) . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_BUY_NOW, 3, 1));
 } else {
     $link = '<a href="' . zen_href_link(zen_get_info_page($products_new->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_new->fields['master_categories_id']) . '&products_id=' . $products_new->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
Example #24
0
         $_SESSION['navigation']->set_snapshot();
         zen_redirect(FILENAME_LOGIN);
     }
     break;
 case 'notify_remove':
     if ($gBitUser->isRegistered() && $gBitProduct->isValid()) {
         $gBitProduct->expungeNotification($gBitUser->mUserId);
         zen_redirect(zen_href_link($_REQUEST['main_page'], zen_get_all_get_params(array('action', 'main_page'))));
     } else {
         $_SESSION['navigation']->set_snapshot();
         zen_redirect(FILENAME_LOGIN);
     }
     break;
 case 'cust_order':
     if ($_SESSION['customer_id'] && isset($_REQUEST['pid'])) {
         if (zen_has_product_attributes($_REQUEST['pid'])) {
             zen_redirect(zen_href_link(zen_get_info_page($_REQUEST['pid']), 'products_id=' . $_REQUEST['pid']));
         } else {
             $gBitDb->Execute("delete FROM " . TABLE_WISHLIST . " WHERE `products_id` = '" . $_REQUEST['pid'] . "' and `customers_id` = '" . $_SESSION['customer_id'] . "'");
             $gBitCustomer->mCart->addToCart($_REQUEST['pid'], $gBitCustomer->mCart->get_quantity($_REQUEST['pid']) + 1);
         }
     }
     zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
     break;
 case 'add_wishlist':
     // Add product to the wishlist
     if (ereg('^[0-9]+$', $_REQUEST['products_id'])) {
         if ($_REQUEST['products_id']) {
             $gBitDb->Execute("delete FROM " . TABLE_WISHLIST . " WHERE `products_id` = '" . $_REQUEST['products_id'] . "' and `customers_id` = '" . $_SESSION['customer_id'] . "'");
             $gBitDb->Execute("insert into " . TABLE_WISHLIST . " (`customers_id`, `products_id`, `products_model`, `products_name`, `products_price`) values ('" . $_SESSION['customer_id'] . "', '" . $_REQUEST['products_id'] . "', '" . $products_model . "', '" . $products_name . "', '" . $products_price . "' )");
         }