コード例 #1
0
 function create_plugin_instance()
 {
     global $categories, $aCategoryPath, $nCurrentCategoryId;
     $categories = '';
     $aCategoryPath = array();
     $nCurrentCategoryId = 0;
     if (isset($_GET['categories'])) {
         $categories = oos_var_prep_for_os($_GET['categories']);
     } elseif (isset($_GET['products_id']) && !isset($_GET['manufacturers_id'])) {
         $categories = oos_get_product_path($_GET['products_id']);
     }
     if (!empty($categories)) {
         $aCategoryPath = array_unique(array_filter(explode('_', $categories), 'is_numeric'));
         $categories = implode('_', $aCategoryPath);
         $nCurrentCategoryId = end($aCategoryPath);
     }
     return true;
 }
コード例 #2
0
 function create_plugin_instance()
 {
     global $categories, $aCategoryPath, $nCurrentCategoryId;
     MyOOS_CoreApi::requireOnce('classes/class_category_tree.php');
     if (isset($_GET['categories'])) {
         $categories = oos_var_prep_for_os($_GET['categories']);
     } elseif (isset($_GET['products_id']) && !isset($_GET['manufacturers_id'])) {
         $categories = oos_get_product_path($_GET['products_id']);
     } else {
         $categories = '';
     }
     if (!empty($categories)) {
         $aCategoryPath = oos_parse_category_path($categories);
         $categories = implode('_', $aCategoryPath);
         $nCurrentCategoryId = end($aCategoryPath);
     } else {
         $nCurrentCategoryId = 0;
     }
     return true;
 }
コード例 #3
0
?>
</td>
                    <td class="smallText" align="right"><?php 
echo $products_split->display_links($products_result_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']);
?>
</td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
<?php 
$heading = array();
$contents = array();
if (isset($pInfo) && is_object($pInfo)) {
    $heading[] = array('text' => '<b>' . $pInfo->products_name . '</b>');
    $categories = oos_get_product_path($pInfo->products_id);
    $contents[] = array('align' => 'center', 'text' => '<a href="' . oos_href_link_admin($aFilename['categories'], 'pID=' . $pInfo->products_id . '&categories=' . $categories . '&action=new_product') . '">' . oos_image_swap_button('edit', 'edit_off.gif', IMAGE_EDIT) . '</a>');
    $contents[] = array('text' => '<br />' . TEXT_INFO_DATE_EXPECTED . ' ' . oos_date_short($pInfo->products_date_available));
}
if (!empty($heading) && !empty($contents)) {
    echo '            <td width="25%" valign="top">' . "\n";
    $box = new box();
    echo $box->infoBox($heading, $contents);
    echo '            </td>' . "\n";
}
?>
          </tr>
        </table></td>
      </tr>
    </table></td>
<!-- body_text_eof //-->
コード例 #4
0
 function calculate_credit($amount)
 {
     global $oOrder;
     // Get database information
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     $od_amount = 0;
     if (isset($_SESSION['cc_id'])) {
         $cc_id = intval($_SESSION['cc_id']);
         $couponstable = $oostable['coupons'];
         $coupon_query = $dbconn->Execute("SELECT coupon_code FROM {$couponstable} WHERE coupon_id = '" . intval($cc_id) . "'");
         if ($coupon_query->RecordCount() != 0) {
             $coupon_result = $coupon_query->fields;
             $this->coupon_code = $coupon_result['coupon_code'];
             $couponstable = $oostable['coupons'];
             $coupon_get = $dbconn->Execute("SELECT coupon_amount, coupon_minimum_order, restrict_to_products, restrict_to_categories, coupon_type FROM {$couponstable} WHERE coupon_code = '" . $coupon_result['coupon_code'] . "'");
             $get_result = $coupon_get->fields;
             $c_deduct = $get_result['coupon_amount'];
             if ($get_result['coupon_type'] == 'S') {
                 $c_deduct = $oOrder->info['shipping_cost'];
             }
             if ($get_result['coupon_minimum_order'] <= $this->get_order_total()) {
                 if ($get_result['restrict_to_products'] || $get_result['restrict_to_categories']) {
                     for ($i = 0; $i < count($oOrder->products); $i++) {
                         if ($get_result['restrict_to_products']) {
                             $pr_ids = split("[,]", $get_result['restrict_to_products']);
                             for ($ii = 0; $ii < count($pr_ids); $ii++) {
                                 if ($pr_ids[$ii] == oos_get_product_id($oOrder->products[$i]['id'])) {
                                     if ($get_result['coupon_type'] == 'P') {
                                         $od_amount = round($amount * 10) / 10 * $c_deduct / 100;
                                         $pr_c = $oOrder->products[$i]['final_price'] * $oOrder->products[$i]['qty'];
                                         $pod_amount = round($pr_c * 10) / 10 * $c_deduct / 100;
                                     } else {
                                         $od_amount = $c_deduct;
                                     }
                                 }
                             }
                         } else {
                             $cat_ids = split("[,]", $get_result['restrict_to_categories']);
                             for ($i = 0; $i < count($oOrder->products); $i++) {
                                 $my_path = oos_get_product_path(oos_get_product_id($oOrder->products[$i]['id']));
                                 $sub_cat_ids = split("[_]", $my_path);
                                 for ($iii = 0; $iii < count($sub_cat_ids); $iii++) {
                                     for ($ii = 0; $ii < count($cat_ids); $ii++) {
                                         if ($sub_cat_ids[$iii] == $cat_ids[$ii]) {
                                             if ($get_result['coupon_type'] == 'P') {
                                                 $od_amount = round($amount * 10) / 10 * $c_deduct / 100;
                                                 $pr_c = $oOrder->products[$i]['final_price'] * $oOrder->products[$i]['qty'];
                                                 $pod_amount = round($pr_c * 10) / 10 * $c_deduct / 100;
                                             } else {
                                                 $od_amount = $c_deduct;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 } else {
                     if ($get_result['coupon_type'] != 'P') {
                         $od_amount = $c_deduct;
                     } else {
                         $od_amount = $amount * $get_result['coupon_amount'] / 100;
                     }
                 }
             }
         }
         if ($od_amount > $amount) {
             $od_amount = $amount;
         }
     }
     return $od_amount;
 }