Ejemplo n.º 1
0
 function quote($method = '')
 {
     global $order, $cart, $shipping_weight, $shipping_num_boxes, $store_id;
     if (MODULE_SHIPPING_TABLE_MODE == 'price') {
         $order_total = $cart->show_total($store_id);
     } else {
         $order_total = $shipping_weight;
     }
     $table_cost = split("[:,]", MODULE_SHIPPING_TABLE_COST);
     $size = sizeof($table_cost);
     for ($i = 0, $n = $size; $i < $n; $i += 2) {
         if ($order_total <= $table_cost[$i]) {
             $shipping = $table_cost[$i + 1];
             break;
         }
     }
     if (MODULE_SHIPPING_TABLE_MODE == 'weight') {
         $shipping = $shipping * $shipping_num_boxes;
     }
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_TABLE_TEXT_WAY, 'cost' => $shipping + MODULE_SHIPPING_TABLE_HANDLING)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = smn_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (smn_not_null($this->icon)) {
         $this->quotes['icon'] = smn_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
Ejemplo n.º 2
0
 function process()
 {
     global $order, $currencies;
     if (MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == 'true') {
         switch (MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION) {
             case 'national':
                 if ($order->delivery['country_id'] == $store->get_store_country()) {
                     $pass = true;
                 }
                 break;
             case 'international':
                 if ($order->delivery['country_id'] != $store->get_store_country()) {
                     $pass = true;
                 }
                 break;
             case 'both':
                 $pass = true;
                 break;
             default:
                 $pass = false;
                 break;
         }
         if ($pass == true && $order->info['total'] - $order->info['shipping_cost'] < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) {
             $tax = smn_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $tax_description = smn_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $order->info['tax'] += smn_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
             $order->info['tax_groups']["{$tax_description}"] += smn_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
             $order->info['total'] += MODULE_ORDER_TOTAL_LOWORDERFEE_FEE + smn_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
             $this->output[] = array('title' => $this->title . ':', 'text' => $currencies->format(smn_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax), true, $order->info['currency'], $order->info['currency_value']), 'value' => smn_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax));
         }
     }
 }
Ejemplo n.º 3
0
 function quote($method = '')
 {
     global $order;
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_FREESHIPPER_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => '<FONT COLOR=FF0000><B>' . MODULE_SHIPPING_FREESHIPPER_TEXT_WAY . '</B></FONT>', 'cost' => SHIPPING_HANDLING + MODULE_SHIPPING_FREESHIPPER_COST)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = smn_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (smn_not_null($this->icon)) {
         $this->quotes['icon'] = smn_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
Ejemplo n.º 4
0
 function quote($method = '')
 {
     global $order;
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_PICK_UP_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_PICK_UP_TEXT_WAY, 'cost' => MODULE_SHIPPING_PICK_UP_COST)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = smn_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (smn_not_null($this->icon)) {
         $this->quotes['icon'] = smn_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
Ejemplo n.º 5
0
 function process()
 {
     global $order, $currencies;
     global $store;
     if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
         switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
             case 'national':
                 if ($order->delivery['country_id'] == $store->get_store_country()) {
                     $pass = true;
                 }
                 break;
             case 'international':
                 if ($order->delivery['country_id'] != $store->get_store_country()) {
                     $pass = true;
                 }
                 break;
             case 'both':
                 $pass = true;
                 break;
             default:
                 $pass = false;
                 break;
         }
         if ($pass == true && $order->info['total'] - $order->info['shipping_cost'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
             $order->info['shipping_method'] = FREE_SHIPPING_TITLE;
             $order->info['total'] -= $order->info['shipping_cost'];
             $order->info['shipping_cost'] = 0;
         }
     }
     $module = substr($GLOBALS['shipping']['id'], 0, strpos($GLOBALS['shipping']['id'], '_'));
     if (smn_not_null($order->info['shipping_method'])) {
         if ($GLOBALS[$module]->tax_class > 0) {
             $shipping_tax = smn_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $shipping_tax_description = smn_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $order->info['tax'] += smn_calculate_tax($order->info['shipping_cost'], $shipping_tax);
             $order->info['tax_groups']["{$shipping_tax_description}"] += smn_calculate_tax($order->info['shipping_cost'], $shipping_tax);
             $order->info['total'] += smn_calculate_tax($order->info['shipping_cost'], $shipping_tax);
             if (DISPLAY_PRICE_WITH_TAX == 'true') {
                 $order->info['shipping_cost'] += smn_calculate_tax($order->info['shipping_cost'], $shipping_tax);
             }
         }
         $this->output[] = array('title' => $order->info['shipping_method'] . ':', 'text' => $currencies->format($order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']), 'value' => $order->info['shipping_cost']);
     }
 }
Ejemplo n.º 6
0
      }

      $products_name .= '    </td>' .
                        '  </tr>' .
                        '</table>';

      $info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"',
                                             'text' => $products_name);

      $info_box_contents[$cur_row][] = array('align' => 'center',
                                             'params' => 'class="productListing-data" valign="top"',
                                             'text' => smn_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . smn_draw_hidden_field('products_id[]', $products[$i]['id']));

      $info_box_contents[$cur_row][] = array('align' => 'right',
                                             'params' => 'class="productListing-data" valign="top"',
                                             'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], smn_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>');
					     
    $cart_total += ($products[$i]['final_price'] * $products[$i]['quantity']) ;
    }
	$tot += $cart_total;
    new productListingBox($info_box_contents);
	?></td></tr></table></td></tr>
<tr>
     <td><?php 
echo smn_draw_separator('pixel_trans.gif', '100%', '10');
?>
</td>
 </tr>
<tr>
     <td align="right" class="main"><b><?php 
echo SUB_TITLE_TOTAL;
Ejemplo n.º 7
0
 function calculate($store = '')
 {
     $this->total_virtual = 0;
     $this->total = 0;
     $this->weight = 0;
     if (!is_array($this->contents)) {
         return 0;
     }
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         $qty = $this->contents[$products_id]['qty'];
         // products price
         $product_query = smn_db_query("select products_model, products_tax_class_id, products_price, store_id, products_price, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int) $products_id . "' LIMIT 1");
         if ($product = smn_db_fetch_array($product_query)) {
             $products_price = $product['products_price'];
             //SW Fix 9-17-2007 : Consider Special Price
             $products_tax = smn_get_tax_rate($product['products_tax_class_id']);
             $no_count = 1;
             $products_weight = $product['products_weight'];
             //SW Fix 10-1-2007 : Shipping Weight Fix
             $products_store_id = $product['store_id'];
             //SW Fix 10-1-2007 : Shipping Weight Fix
             if (ereg('^GIFT', $gv_result['products_model'])) {
                 $no_count = 0;
             }
             $specials_query = smn_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int) $products_id . "' and status = '1' and store_id = '" . (int) $product['store_id'] . "' LIMIT 1");
             if (smn_db_num_rows($specials_query)) {
                 $specials = smn_db_fetch_array($specials_query);
                 $products_price = $specials['specials_new_products_price'];
             }
             if (isset($store) && $store != '') {
                 if ($products_store_id == $store) {
                     $this->total_virtual += smn_add_tax($products_price, $products_tax) * $qty * $no_count;
                     //SW Fix 9-17-2007 : Consider Special Price
                     $this->weight_virtual += $qty * $products_weight * $no_count;
                     $this->total += smn_add_tax($products_price, $products_tax) * $qty;
                     //SW Fix 9-17-2007 : Consider Special Price
                     $this->weight += $qty * $products_weight;
                     //SW Fix 10-1-2007 : Shipping Weight Fix
                 }
             } else {
                 $this->total_virtual += smn_add_tax($products_price, $products_tax) * $qty * $no_count;
                 //SW Fix 9-17-2007 : Consider Special Price
                 $this->weight_virtual += $qty * $products_weight * $no_count;
                 //SW Fix 10-1-2007 : Shipping Weight Fix
                 $this->total += smn_add_tax($products_price, $products_tax) * $qty;
                 //SW Fix 9-17-2007 : Consider Special Price
                 $this->weight += $qty * $products_weight;
                 //SW Fix 10-1-2007 : Shipping Weight Fix
             }
         }
         // attributes price
         if (isset($this->contents[$products_id]['attributes'])) {
             reset($this->contents[$products_id]['attributes']);
             while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
                 $attribute_price_query = smn_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int) $products_id . "' and options_id = '" . (int) $option . "' and store_id = '" . $products_store_id . "' and options_values_id = '" . (int) $value . "' LIMIT 1");
                 $attribute_price = smn_db_fetch_array($attribute_price_query);
                 if ($attribute_price['price_prefix'] == '+') {
                     $this->total += $qty * smn_add_tax($attribute_price['options_values_price'], $products_tax);
                 } else {
                     $this->total -= $qty * smn_add_tax($attribute_price['options_values_price'], $products_tax);
                 }
             }
         }
     }
 }
                    echo $products_options_name['products_options_comment'];
                    if ($products_attribs_array['options_values_price'] != '0') {
                        echo '(' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], $product_info_values['products_tax_class_id']) . ')&nbsp';
                    }
                    echo '</td></tr>';
                    break;
                default:
                    //clr 030714 default is select list
                    //clr 030714 reset selected_attribute variable
                    $selected_attribute = false;
                    $products_options_array = array();
                    $products_options_query = smn_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int) $_GET['products_id'] . "' and pa.options_id = '" . (int) $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int) $languages_id . "'");
                    while ($products_options = smn_db_fetch_array($products_options_query)) {
                        $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
                        if ($products_options['options_values_price'] != '0') {
                            $products_options_array[sizeof($products_options_array) - 1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], smn_get_tax_rate($product_info['products_tax_class_id'])) . ') ';
                        }
                    }
                    if (isset($cart->contents[$_GET['products_id']]['attributes'][$products_options_name['products_options_id']])) {
                        $selected_attribute = $cart->contents[$_GET['products_id']]['attributes'][$products_options_name['products_options_id']];
                    } else {
                        $selected_attribute = false;
                    }
                    ?>
            <tr>
              <td class="main"><?php 
                    echo $products_options_name['products_options_name'] . ':';
                    ?>
</td>
              <td class="main"><?php 
                    echo smn_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute) . $products_options_name['products_options_comment'];
Ejemplo n.º 9
0
    // Tax (not in shopping cart, tax rate may be unknown)
    if (!strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {
        echo '    <td align="center" valign="top" class="main">' . number_format($products[$i]['tax'], TAX_DECIMAL_PLACES) . '%</td>' . "\n";
    }
    // Product price
    if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) {
        echo '    <td align="right" valign="top" class="main"><b>' . $currencies->display_price($products[$i]['price'], smn_get_tax_rate($products[$i]['tax_class_id'], '', '', $products[$i]['store_id']), $products[$i]['quantity']) . '</b>';
    } else {
        echo '    <td align="right" valign="top" class="main"><b>' . $currencies->display_price($products[$i]['price'], $products[$i]['tax'], $products[$i]['quantity']) . '</b>';
    }
    // Product options prices
    if ($attributes_exist == 1) {
        reset($products[$i]['attributes']);
        while (list($option, $value) = each($products[$i]['attributes'])) {
            if ($products[$i][$option]['options_values_price'] != 0) {
                if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) {
                    echo '<br><small><i>' . $products[$i][$option]['price_prefix'] . $currencies->display_price($products[$i][$option]['options_values_price'], smn_get_tax_rate($products[$i]['tax_class_id'], '', '', $products[$i]['store_id']), $products[$i]['quantity']) . '</i></small>';
                } else {
                    echo '<br><small><i>' . $products[$i][$option]['price_prefix'] . $currencies->display_price($products[$i][$option]['options_values_price'], $products[$i]['tax'], $products[$i]['quantity']) . '</i></small>';
                }
            } else {
                // Keep price aligned with corresponding option
                echo '<br><small><i>&nbsp;</i></small>';
            }
        }
    }
    echo '</td>' . "\n" . '  </tr>' . "\n";
}
?>
<!-- order_details_eof -->
Ejemplo n.º 10
0
        new contentBoxHeading($info_box_contents);
        $row = 0;
        $col = 0;
        $info_box_contents = array();
        while ($xsell = smn_db_fetch_array($xsell_query)) {
            $xsell['specials_new_products_price'] = smn_get_products_special_price($xsell['products_id']);
            $store_images = 'images/' . $xsell['store_id'] . '_images/';
            if ($xsell['specials_new_products_price']) {
                $xsell_price = '<s>' . $currencies->display_price($xsell['products_price'], smn_get_tax_rate($xsell['products_tax_class_id'], '', '', $xsell['store_id'])) . '</s><br>';
                $xsell_price .= '<span class="productSpecialPrice">' . $currencies->display_price($xsell['specials_new_products_price'], smn_get_tax_rate($xsell['products_tax_class_id'], '', '', $xsell['store_id'])) . '</span>';
            } else {
                $xsell_price = $currencies->display_price($xsell['products_price'], smn_get_tax_rate($xsell['products_tax_class_id'], '', '', $xsell['store_id']));
            }
            $info_box_contents[$row][$col] = array('text' => '<TABLE><TR><TD align="center" class="infoBoxContents" width="100"><div align="left">
 					    <a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'ID=' . $xsell['store_id'] . '&products_id=' . $xsell['products_id']) . '">' . smn_image($store_images . $xsell['products_image'], $xsell['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></TD><TD class="infoBoxContents">
					    <a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'ID=' . $xsell['store_id'] . '&products_id=' . $xsell['products_id']) . '</a><br>' . TEXT_PRICE_SOLO . '<br>' . $currencies->display_price($xsell['products_price'], smn_get_tax_rate($xsell['products_tax_class_id'], '', '', $xsell['store_id'])) . '</div></td></tr></table>');
            $col++;
            if ($col > 0) {
                $col = 0;
                $row++;
            }
        }
        new contentBox($info_box_contents);
        $info_box_contents = array();
        $info_box_contents[] = array('align' => 'left', 'text' => ' ');
        new infoBoxDefault($info_box_contents, true, true);
        ?>
<!-- xsell_products_eof //-->


Ejemplo n.º 11
0
 function get_product_price($product_id)
 {
     global $cart, $order;
     $products_id = smn_get_prid($product_id);
     // products price
     $qty = $cart->contents[$product_id]['qty'];
     $product_query = smn_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id='" . $product_id . "'");
     if ($product = smn_db_fetch_array($product_query)) {
         $prid = $product['products_id'];
         $products_tax = smn_get_tax_rate($product['products_tax_class_id']);
         $products_price = $product['products_price'];
         $specials_query = smn_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $prid . "' and status = '1'");
         if (smn_db_num_rows($specials_query)) {
             $specials = smn_db_fetch_array($specials_query);
             $products_price = $specials['specials_new_products_price'];
         }
         if ($this->include_tax == 'true') {
             $total_price += ($products_price + smn_calculate_tax($products_price, $products_tax)) * $qty;
         } else {
             $total_price += $products_price * $qty;
         }
         // attributes price
         if (isset($cart->contents[$product_id]['attributes'])) {
             reset($cart->contents[$product_id]['attributes']);
             while (list($option, $value) = each($cart->contents[$product_id]['attributes'])) {
                 $attribute_price_query = smn_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $prid . "' and options_id = '" . $option . "' and options_values_id = '" . $value . "'");
                 $attribute_price = smn_db_fetch_array($attribute_price_query);
                 if ($attribute_price['price_prefix'] == '+') {
                     if ($this->include_tax == 'true') {
                         $total_price += $qty * ($attribute_price['options_values_price'] + smn_calculate_tax($attribute_price['options_values_price'], $products_tax));
                     } else {
                         $total_price += $qty * $attribute_price['options_values_price'];
                     }
                 } else {
                     if ($this->include_tax == 'true') {
                         $total_price -= $qty * ($attribute_price['options_values_price'] + smn_calculate_tax($attribute_price['options_values_price'], $products_tax));
                     } else {
                         $total_price -= $qty * $attribute_price['options_values_price'];
                     }
                 }
             }
         }
     }
     if ($this->include_shipping == 'true') {
         $total_price += $order->info['shipping_cost'];
     }
     return $total_price;
 }
Ejemplo n.º 12
0
       				<TD style="padding-left: 8px;">
					
					
					<TABLE border="0" width="100%" cellspacing="0" cellpadding="0">
						<TR>
       						<TD style="' . $style1 . '">' . smn_draw_separator('pixel_trans.gif', '100%', '7') . '</TD>
						</TR>
					</TABLE>
					
					
					
					</TD>					
				</TR>
				<TR>
       				<TD style="' . $style2 . 'padding-left: 7px;">
				<SPAN CLASS="priceNew">' . $currencies->display_price($new_products['products_price'], smn_get_tax_rate($new_products['products_tax_class_id'])) . '</SPAN><br>
				' . smn_draw_hidden_field('products_id', $new_products['products_id']) . smn_image_submit('add_to_cart.gif', IMAGE_BUTTON_IN_CART) . '<br>
				<a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'ID=' . $new_products['store_id'] . '&products_id=' . $new_products['products_id']) . '">' . smn_image(DIR_WS_CATALOG_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a class="prodNameNew" href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'ID=' . $new_products['store_id'] . '&products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $new_products['products_description'] . '
			    	</TD>
				</TR>
			</TABLE>										   						   
		      </FORM>');
    $nr++;
    $col++;
    if ($col > 1) {
        $col = 0;
        $row++;
    }
}
new contentBox($info_box_contents);
?>
Ejemplo n.º 13
0
     }
     break;
 case 'MASTER_LIST_DESCRIPTION':
     $lc_align = '';
     $lc_text = '&nbsp;' . osc_trunc_string(strip_tags($listing['products_description'], '<a><b><em><font><i><s><span><strong><sub><sup><u>'), MASTER_LIST_DESCRIPTION_LENGTH) . '&nbsp;';
     break;
 case 'MASTER_LIST_MANUFACTURER':
     $lc_align = '';
     $lc_text = '&nbsp;<a href="' . smn_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a>&nbsp;';
     break;
 case 'MASTER_LIST_PRICE':
     $lc_align = 'right';
     if (smn_not_null($listing['specials_new_products_price'])) {
         $lc_text = '&nbsp;<s>' . $currencies->display_price($listing['products_price'], smn_get_tax_rate($listing['products_tax_class_id'], '', '', $listing['store_id'])) . '</s>&nbsp;&nbsp;<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], smn_get_tax_rate($listing['products_tax_class_id'], '', '', $listing['store_id'])) . '</span>&nbsp;';
     } else {
         $lc_text = '&nbsp;' . $currencies->display_price($listing['products_price'], smn_get_tax_rate($listing['products_tax_class_id'], '', '', $listing['store_id'])) . '&nbsp;';
     }
     break;
 case 'MASTER_LIST_QUANTITY':
     $lc_align = 'center';
     $lc_text = '&nbsp;' . $listing['products_quantity'] . '&nbsp;';
     break;
 case 'MASTER_LIST_WEIGHT':
     $lc_align = 'right';
     $lc_text = '&nbsp;' . $listing['products_weight'] . '&nbsp;';
     break;
 case 'MASTER_LIST_IMAGE':
     $lc_align = 'center';
     if (isset($_GET['manufacturers_id'])) {
         $lc_text = '<a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $_GET['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . smn_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
     } else {
Ejemplo n.º 14
0
 function quote_store($method = '')
 {
     global $order, $shipping_weight, $shipping_num_boxes, $transittime, $cart;
     if (smn_not_null($method) && (isset($this->types[$method]) || in_array($method, $this->intl_types))) {
         $this->_setService($method);
     }
     $this->_setContainer('None');
     $this->_setSize('REGULAR');
     // usps doesnt accept zero weight
     $shipping_weight = $shipping_weight < 0.1 ? 0.1 : $shipping_weight;
     $shipping_pounds = floor($shipping_weight);
     $shipping_ounces = round(16 * ($shipping_weight - floor($shipping_weight)));
     $this->_setWeight($shipping_pounds, $shipping_ounces);
     // Added by Kevin Chen (kkchen@uci.edu); Fixes the Parcel Post Bug July 1, 2004
     // Refer to http://www.usps.com/webtools/htm/Domestic-Rates.htm documentation
     // Thanks Ryan
     if ($shipping_pounds > 35 || $shipping_pounds == 0 && $shipping_ounces < 6) {
         $this->_setMachinable('False');
     } else {
         $this->_setMachinable('True');
     }
     // End Kevin Chen July 1, 2004
     if (in_array('Display weight', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) {
         $shiptitle = ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)';
     } else {
         $shiptitle = '';
     }
     $store_list = $cart->get_store_list();
     for ($k = 0; $k < sizeof($store_list); $k++) {
         define('SHIPPING_ORIGIN_COUNTRY', $cart->get_cart_store_country($store_list[$k]));
         define('SHIPPING_ORIGIN_ZIP', $cart->get_cart_store_zip($store_list[$k]));
         define('STORE_ORIGIN_ZIP', $cart->get_cart_store_zip($store_list[$k]));
         $uspsQuote[$store_list[$k]] = $this->_getQuote();
     }
     foreach ($uspsQuote as $key => $value) {
         if (is_array($value)) {
             if (isset($value['error'])) {
                 $this->quotes_store[$key] = array('module' => $this->title, 'error' => $value['error']);
             } else {
                 $this->quotes_store[$key] = array('id' => $this->code, 'module' => $this->title . $shiptitle);
                 $methods = array();
                 $size = sizeof($value);
                 for ($i = 0; $i < $size; $i++) {
                     list($type, $cost) = each($value[$i]);
                     $title = isset($this->types[$type]) ? $this->types[$type] : $type;
                     if (in_array('Display transit time', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) {
                         $title .= $transittime[$type];
                     }
                     $methods[] = array('id' => $type, 'title' => $title, 'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
                 }
                 $this->quotes_store[$key]['methods'] = $methods;
                 if ($this->tax_class > 0) {
                     $this->quotes_store[$key]['tax'] = smn_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
                 }
             }
         } else {
             $this->quotes_store[$key] = array('module' => $this->title, 'error' => MODULE_SHIPPING_USPS_TEXT_ERROR);
         }
         if (smn_not_null($this->icon)) {
             $this->quotes_store[$key]['icon'] = smn_image($this->icon, $this->title);
         }
     }
     return $this->quotes_store;
 }
Ejemplo n.º 15
0
 function calculate_tax_deduction($amount, $od_amount, $method)
 {
     global $order;
     switch ($method) {
         case 'Standard':
             $ratio1 = $amount == 0 ? 0 : smn_round($od_amount / $amount, 2);
             $tod_amount = 0;
             reset($order->info['tax_groups']);
             while (list($key, $value) = each($order->info['tax_groups'])) {
                 $tax_rate = smn_get_tax_rate_from_desc($key);
                 $total_net += $tax_rate * $order->info['tax_groups'][$key];
             }
             if ($od_amount > $total_net) {
                 $od_amount = $total_net;
             }
             reset($order->info['tax_groups']);
             while (list($key, $value) = each($order->info['tax_groups'])) {
                 $tax_rate = smn_get_tax_rate_from_desc($key);
                 $net = $tax_rate * $order->info['tax_groups'][$key];
                 if ($net > 0) {
                     $god_amount = $order->info['tax_groups'][$key] * $ratio1;
                     $tod_amount += $god_amount;
                     $order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount;
                 }
             }
             $order->info['tax'] -= $tod_amount;
             $order->info['total'] -= $tod_amount;
             break;
         case 'Credit Note':
             $tax_rate = smn_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $tax_desc = smn_get_tax_description($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $tod_amount = $this->deduction / (100 + $tax_rate) * $tax_rate;
             $order->info['tax_groups'][$tax_desc] -= $tod_amount;
             break;
         default:
     }
     return $tod_amount;
 }
Ejemplo n.º 16
0
  did not receive a copy of the oscMall System license and are unable 
  to obtain it through the world-wide-web, please send a note to    
  license@systemsmanager.net so we can mail you a copy immediately.
*/
if ($random_product = smn_random_select("select store_id, products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where store_id = '" . $store_id . "' and products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
    $boxHeading = BOX_HEADING_WHATS_NEW;
    $corner_left = 'square';
    $corner_right = 'square';
    $boxContent_attributes = ' align="center"';
    $boxLink = '<a href="' . smn_href_link(FILENAME_PRODUCTS_NEW) . '"><img src="images/infobox/arrow_right.gif" border="0" alt="more" title=" more " width="12" height="10"></a>';
    $box_base_name = 'whats_new';
    $box_id = $box_base_name . 'Box';
    $random_product['products_name'] = smn_get_products_name($random_product['products_id']);
    $random_product['specials_new_products_price'] = smn_get_products_special_price($random_product['products_id']);
    $store_images = 'images/' . $random_product['store_id'] . '_images/';
    if (smn_not_null($random_product['specials_new_products_price'])) {
        $whats_new_price = '<s>' . $currencies->display_price($random_product['products_price'], smn_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>';
        $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], smn_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
    } else {
        $whats_new_price = $currencies->display_price($random_product['products_price'], smn_get_tax_rate($random_product['products_tax_class_id']));
    }
    $boxContent = '<a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'ID=' . $random_product['store_id'] . '&products_id=' . $random_product['products_id']) . '">' . smn_image($store_images . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'ID=' . $random_product['store_id'] . '&products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>' . $whats_new_price;
    if (file_exists(DIR_WS_BOX_TEMPLATES . $box_base_name . '.php')) {
        require DIR_WS_BOX_TEMPLATES . $box_base_name . '.php';
    } else {
        require DEFAULT_TEMPLATENAME_BOX;
    }
    $boxContent_attributes = '';
    $boxLink = '';
    $boxContent_attributes = '';
}
Ejemplo n.º 17
0
 function quote_store($method = '')
 {
     global $_POST, $order, $shipping_weight, $shipping_num_boxes, $cart;
     global $store;
     if (smn_not_null($method) && isset($this->types[$method])) {
         $prod = $method;
     } else {
         $prod = 'GNDRES';
     }
     if ($method) {
         $this->_upsAction('3');
     }
     // return a single quote
     $this->_upsProduct($prod);
     $store_list = $cart->get_store_list();
     for ($k = 0; $k < sizeof($store_list); $k++) {
         $country_name = smn_get_countries($cart->get_cart_store_country($store_list[$k]), true);
         $this->_upsOrigin($cart->get_cart_store_zip($store_list[$k]), $country_name['countries_iso_code_2']);
         $this->_upsDest($order->delivery['postcode'], $order->delivery['country']['iso_code_2']);
         $this->_upsRate(MODULE_SHIPPING_UPS_PICKUP);
         $this->_upsContainer(MODULE_SHIPPING_UPS_PACKAGE);
         $this->_upsWeight($shipping_weight);
         $this->_upsRescom(MODULE_SHIPPING_UPS_RES);
         $upsQuote[$store_list[$k]] = $this->_upsGetQuote();
     }
     foreach ($upsQuote as $key => $value) {
         if (is_array($value) && sizeof($value) > 0) {
             $this->quotes_store[$key] = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)');
             $methods = array();
             $qsize = sizeof($value);
             for ($i = 0; $i < $qsize; $i++) {
                 list($type, $cost) = each($value[$i]);
                 $methods[] = array('id' => $type, 'title' => $this->types[$type], 'cost' => ($cost + MODULE_SHIPPING_UPS_HANDLING) * $shipping_num_boxes);
             }
             $this->quotes_store[$key]['methods'] = $methods;
             if ($this->tax_class > 0) {
                 $this->quotes_store[$key]['tax'] = smn_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
             }
         } else {
             $this->quotes_store[$key] = array('module' => $this->title, 'error' => 'An error occured with the UPS shipping calculations.<br>' . $upsQuote . '<br>If you prefer to use UPS as your shipping method, please contact the store owner.');
         }
         if (smn_not_null($this->icon)) {
             $this->quotes_store[$key]['icon'] = smn_image($this->icon, $this->title);
         }
     }
     return $this->quotes_store;
 }
Ejemplo n.º 18
0
if (sizeof($products_new_array) < 1) {
    ?>
  <tr>
    <td class="main"><?php 
    echo TEXT_NO_NEW_PRODUCTS;
    ?>
</td>
  </tr>
<?php 
} else {
    for ($i = 0, $n = sizeof($products_new_array); $i < $n; $i++) {
        $store_images = 'images/' . $products_new_array[$i]['store_id'] . '_images/';
        if (isset($products_new_array[$i]['specials_price'])) {
            $products_price = '<s>' . $currencies->display_price($products_new_array[$i]['price'], smn_get_tax_rate($products_new_array[$i]['tax_class_id'], '', '', $products_new_array[$i]['store_id'])) . '</s>&nbsp;&nbsp;<span class="productSpecialPrice">' . $currencies->display_price($products_new_array[$i]['specials_price'], smn_get_tax_rate($products_new_array[$i]['tax_class_id'], '', '', $products_new_array[$i]['store_id'])) . '</span>';
        } else {
            $products_price = $currencies->display_price($products_new_array[$i]['price'], smn_get_tax_rate($products_new_array[$i]['tax_class_id'], '', '', $products_new_array[$i]['store_id']));
        }
        ?>
  <tr>
    <td width="<?php 
        echo SMALL_IMAGE_WIDTH + 10;
        ?>
" valign="top" class="main"><?php 
        echo '<a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new_array[$i]['id'] . '&ID=' . $products_new_array[$i]['store_id']) . '">' . smn_image($store_images . $products_new_array[$i]['image'], $products_new_array[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
        ?>
</td>
    <td valign="top" class="main"><?php 
        echo '<a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new_array[$i]['id'] . '&ID=' . $products_new_array[$i]['store_id']) . '"><b><u>' . $products_new_array[$i]['name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . $products_new_array[$i]['date_added'] . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new_array[$i]['manufacturer'] . '<br><br>' . TEXT_PRICE . ' ' . $products_price;
        ?>
</td>
    <td align="right" valign="middle" class="main"><?php 
Ejemplo n.º 19
0
 function quote($method = '')
 {
     global $order, $shipping_weight, $shipping_num_boxes;
     $dest_country = $order->delivery['country']['iso_code_2'];
     $dest_zone = 0;
     $error = false;
     for ($i = 1; $i <= $this->num_zones; $i++) {
         $countries_table = constant('MODULE_SHIPPING_ZONES_COUNTRIES_' . $i);
         $country_zones = split("[,]", $countries_table);
         if (in_array($dest_country, $country_zones)) {
             $dest_zone = $i;
             break;
         }
     }
     if ($dest_zone == 0) {
         $error = true;
     } else {
         $shipping = -1;
         $zones_cost = constant('MODULE_SHIPPING_ZONES_COST_' . $dest_zone);
         $zones_table = split("[:,]", $zones_cost);
         $size = sizeof($zones_table);
         for ($i = 0; $i < $size; $i += 2) {
             if ($shipping_weight <= $zones_table[$i]) {
                 $shipping = $zones_table[$i + 1];
                 $shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . $dest_country . ' : ' . $shipping_weight . ' ' . MODULE_SHIPPING_ZONES_TEXT_UNITS;
                 break;
             }
         }
         if ($shipping == -1) {
             $shipping_cost = 0;
             $shipping_method = MODULE_SHIPPING_ZONES_UNDEFINED_RATE;
         } else {
             $shipping_cost = $shipping * $shipping_num_boxes + constant('MODULE_SHIPPING_ZONES_HANDLING_' . $dest_zone);
         }
     }
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ZONES_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => $shipping_method, 'cost' => $shipping_cost)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = smn_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (smn_not_null($this->icon)) {
         $this->quotes['icon'] = smn_image($this->icon, $this->title);
     }
     if ($error == true) {
         $this->quotes['error'] = MODULE_SHIPPING_ZONES_INVALID_ZONE;
     }
     return $this->quotes;
 }
  that is bundled with this package in the file LICENSE. If you
  did not receive a copy of the oscMall System license and are unable 
  to obtain it through the world-wide-web, please send a note to    
  license@systemsmanager.net so we can mail you a copy immediately.
*/
global $page_name;
if (isset($_GET['reviews_id']) && smn_not_null($_GET['reviews_id']) && isset($_GET['products_id']) && smn_not_null($_GET['products_id'])) {
    $review_check_query = smn_db_query("select count(*) as total from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.reviews_id = '" . (int) $_GET['reviews_id'] . "' and r.products_id = '" . (int) $_GET['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int) $languages_id . "'");
    $review_check = smn_db_fetch_array($review_check_query);
    if ($review_check['total'] < 1) {
        smn_redirect(smn_href_link(FILENAME_PRODUCT_REVIEWS, smn_get_all_get_params(array('reviews_id'))));
    }
} else {
    smn_redirect(smn_href_link(FILENAME_PRODUCT_REVIEWS, smn_get_all_get_params(array('reviews_id'))));
}
smn_db_query("update " . TABLE_REVIEWS . " set reviews_read = reviews_read+1 where reviews_id = '" . (int) $_GET['reviews_id'] . "'");
/* Changed the query to get store id from the DB by Cimi on June 08,2007*/
/*$review_query = smn_db_query("select rd.reviews_text, r.reviews_rating, r.reviews_id, r.customers_name, r.date_added, r.reviews_read, p.products_id, p.products_price, p.products_tax_class_id, p.products_image, p.products_model, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where r.reviews_id = '" . (int)$_GET['reviews_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and r.products_id = p.products_id and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '". (int)$languages_id . "'");*/
$review_query = smn_db_query("select rd.reviews_text, r.reviews_rating, r.reviews_id, r.customers_name, r.date_added, r.reviews_read,p.store_id, p.products_id, p.products_price, p.products_tax_class_id, p.products_image, p.products_model, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where r.reviews_id = '" . (int) $_GET['reviews_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int) $languages_id . "' and r.products_id = p.products_id and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "'");
$review = smn_db_fetch_array($review_query);
if ($new_price = smn_get_products_special_price($review['products_id'])) {
    $products_price = '<s>' . $currencies->display_price($review['products_price'], smn_get_tax_rate($review['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, smn_get_tax_rate($review['products_tax_class_id'])) . '</span>';
} else {
    $products_price = $currencies->display_price($review['products_price'], smn_get_tax_rate($review['products_tax_class_id']));
}
if (smn_not_null($review['products_model'])) {
    $products_name = $review['products_name'] . '<br><span class="smallText">[' . $review['products_model'] . ']</span>';
} else {
    $products_name = $review['products_name'];
}
$breadcrumb->add(NAVBAR_TITLE, smn_href_link(FILENAME_PRODUCT_REVIEWS, smn_get_all_get_params()));
Ejemplo n.º 21
0
            $stock_check = smn_check_stock($products[$i]['id'], $products[$i]['quantity']);
            if (smn_not_null($stock_check)) {
                $any_out_of_stock = 1;
                $products_name .= $stock_check;
            }
        }
        if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
            reset($products[$i]['attributes']);
            while (list($option, $value) = each($products[$i]['attributes'])) {
                $products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
            }
        }
        $products_name .= '    </td>' . '  </tr>' . '</table>';
        $info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"', 'text' => $products_name);
        $info_box_contents[$cur_row][] = array('align' => 'center', 'params' => 'class="productListing-data" valign="top"', 'text' => smn_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . smn_draw_hidden_field('products_id[]', $products[$i]['id']));
        $info_box_contents[$cur_row][] = array('align' => 'right', 'params' => 'class="productListing-data" valign="top"', 'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], smn_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>');
    }
    new productListingBox($info_box_contents);
    ?>
        </td>
      </tr>
      <tr>
        <td><?php 
    echo smn_draw_separator('pixel_trans.gif', '100%', '10');
    ?>
</td>
      </tr>
      <tr>
        <td align="right" class="main"><b><?php 
    echo SUB_TITLE_SUB_TOTAL;
    ?>
Ejemplo n.º 22
0
$cat_name_query = smn_db_query("select categories_name from categories_description where categories_id = '" . $featured_products_category_id . "' limit 1");
$cat_name_fetch = smn_db_fetch_array($cat_name_query);
$cat_name = $cat_name_fetch['categories_name'];
$info_box_contents = array();
if (!isset($featured_products_category_id) || $featured_products_category_id == '0') {
    $featured_products_query = smn_db_query("select p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, p.store_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.store_id = '" . $store_id . "' and p.products_status = '1' and f.status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);
} else {
    $featured_products_query = smn_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price, p.store_id from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.store_id = '" . $store_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $featured_products_category_id . "' and p.products_status = '1' and f.status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);
}
$count = 0;
while ($featured_products = smn_db_fetch_array($featured_products_query)) {
    if ($featured_products['specials_new_products_price']) {
        $whats_new_price = '<s>' . $currencies->display_price($featured_products['products_price'], smn_get_tax_rate($featured_products['products_tax_class_id'], '', '', $featured_products['store_id'])) . '</s><br>';
        $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($featured_products['specials_new_products_price'], smn_get_tax_rate($featured_products['products_tax_class_id'], '', '', $featured_products['store_id'])) . '</span>';
    } else {
        $whats_new_price = $currencies->display_price($featured_products['products_price'], smn_get_tax_rate($featured_products['products_tax_class_id'], '', '', $featured_products['store_id']));
    }
    $featured_products['products_description'] = smn_get_products_description($featured_products['products_id']);
    $featured_products['products_name'] = smn_get_products_name($featured_products['products_id']);
    $store_images = 'images/' . $featured_products['store_id'] . '_images/';
    ?>
    <td width="50%">
<?php 
    $info_box_contents[] = array('align' => 'center', 'text' => '<a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'ID=' . $featured_products['store_id'] . '&products_id=' . $featured_products['products_id']) . '">' . smn_image($store_images . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td><td><a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'ID=' . $featured_products['store_id'] . '&products_id=' . $featured_products['products_id']) . '"></a></td><td align="center">' . $whats_new_price . '<br><br><a href="' . smn_href_link(basename($PHP_SELF), smn_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products['products_id'], 'NONSSL') . '">' . smn_image_button('button_buy_now.gif') . '</a>&nbsp;<br></td><tr><td colspan="3" align="top" valign="top" height="100">' . osc_trunc_string(strip_tags($featured_products['products_description'])) . '<br><br><a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'ID=' . $featured_products['store_id'] . '&products_id=' . $featured_products['products_id']) . '">More Info...</a>');
    new infoBox($info_box_contents);
    $info_box_contents = array();
    $info_box_contents[] = array('align' => 'left', 'text' => ' ');
    new infoBoxDefault($info_box_contents, true, true);
    //echo '</td>';
    $count++;
    if ($count > 1) {
Ejemplo n.º 23
0
 function cart()
 {
     /*Declared shipping_store as global,by Cimi*/
     global $HTTP_POST_VARS, $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, $shipping_store, $payment, $store_id, $comments, $customer_default_address_id;
     $this->content_type = $cart->get_content_type();
     if ($this->content_type != 'virtual' && $sendto == false) {
         $sendto = $customer_default_address_id;
     }
     $customer_address_query = smn_db_query("select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int) $customer_id . "' and ab.customers_id = '" . (int) $customer_id . "' and c.customers_default_address_id = ab.address_book_id");
     $customer_address = smn_db_fetch_array($customer_address_query);
     if (is_array($sendto) && !empty($sendto)) {
         $shipping_address = array('entry_firstname' => $sendto['firstname'], 'entry_lastname' => $sendto['lastname'], 'entry_company' => $sendto['company'], 'entry_street_address' => $sendto['street_address'], 'entry_suburb' => $sendto['suburb'], 'entry_postcode' => $sendto['postcode'], 'entry_city' => $sendto['city'], 'entry_zone_id' => $sendto['zone_id'], 'zone_name' => $sendto['zone_name'], 'entry_country_id' => $sendto['country_id'], 'countries_id' => $sendto['country_id'], 'countries_name' => $sendto['country_name'], 'countries_iso_code_2' => $sendto['country_iso_code_2'], 'countries_iso_code_3' => $sendto['country_iso_code_3'], 'address_format_id' => $sendto['address_format_id'], 'entry_state' => $sendto['zone_name']);
     } elseif (is_numeric($sendto)) {
         $shipping_address_query = smn_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int) $customer_id . "' and ab.address_book_id = '" . (int) $sendto . "'");
         $shipping_address = smn_db_fetch_array($shipping_address_query);
     } else {
         $shipping_address = array('entry_firstname' => null, 'entry_lastname' => null, 'entry_company' => null, 'entry_street_address' => null, 'entry_suburb' => null, 'entry_postcode' => null, 'entry_city' => null, 'entry_zone_id' => null, 'zone_name' => null, 'entry_country_id' => null, 'countries_id' => null, 'countries_name' => null, 'countries_iso_code_2' => null, 'countries_iso_code_3' => null, 'address_format_id' => 0, 'entry_state' => null);
     }
     if (is_array($billto) && !empty($billto)) {
         $billing_address = array('entry_firstname' => $billto['firstname'], 'entry_lastname' => $billto['lastname'], 'entry_company' => $billto['company'], 'entry_street_address' => $billto['street_address'], 'entry_suburb' => $billto['suburb'], 'entry_postcode' => $billto['postcode'], 'entry_city' => $billto['city'], 'entry_zone_id' => $billto['zone_id'], 'zone_name' => $billto['zone_name'], 'entry_country_id' => $billto['country_id'], 'countries_id' => $billto['country_id'], 'countries_name' => $billto['country_name'], 'countries_iso_code_2' => $billto['country_iso_code_2'], 'countries_iso_code_3' => $billto['country_iso_code_3'], 'address_format_id' => $billto['address_format_id'], 'entry_state' => $billto['zone_name']);
     } else {
         $billing_address_query = smn_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int) $customer_id . "' and ab.address_book_id = '" . (int) $billto . "'");
         $billing_address = smn_db_fetch_array($billing_address_query);
     }
     if ($this->content_type == 'virtual') {
         $tax_address = array('entry_country_id' => $billing_address['entry_country_id'], 'entry_zone_id' => $billing_address['entry_zone_id']);
     } else {
         $tax_address = array('entry_country_id' => $shipping_address['entry_country_id'], 'entry_zone_id' => $shipping_address['entry_zone_id']);
     }
     $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID, 'currency' => $currency, 'currency_value' => $currencies->currencies[$currency]['value'], 'payment_method' => $payment, 'cc_type' => '', 'cc_owner' => '', 'cc_number' => '', 'cc_expires' => '', 'shipping_method' => $shipping['title'], 'shipping_cost' => $shipping['cost'], 'subtotal' => 0, 'tax' => 0, 'tax_groups' => array(), 'comments' => smn_session_is_registered('comments') && !empty($comments) ? $comments : '');
     /*Added the code to put the shipping cost of selected the shipping method of each store,By Cimi*/
     $store_list = $cart->get_store_list();
     for ($k = 0; $k < sizeof($store_list); $k++) {
         $this->info_store[$store_list[$k]] = array('shipping_cost' => $shipping_store[$store_list[$k]]['cost']);
     }
     /*End of code*/
     if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) {
         if (isset($GLOBALS[$payment]->public_title)) {
             $this->info['payment_method'] = $GLOBALS[$payment]->public_title;
         } else {
             $this->info['payment_method'] = $GLOBALS[$payment]->title;
         }
         if (isset($GLOBALS[$payment]->order_status) && is_numeric($GLOBALS[$payment]->order_status) && $GLOBALS[$payment]->order_status > 0) {
             $this->info['order_status'] = $GLOBALS[$payment]->order_status;
         }
     }
     $this->customer = array('firstname' => $customer_address['customers_firstname'], 'lastname' => $customer_address['customers_lastname'], 'company' => $customer_address['entry_company'], 'street_address' => $customer_address['entry_street_address'], 'city' => $customer_address['entry_city'], 'postcode' => $customer_address['entry_postcode'], 'state' => smn_not_null($customer_address['entry_state']) ? $customer_address['entry_state'] : $customer_address['zone_name'], 'zone_id' => $customer_address['entry_zone_id'], 'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']), 'format_id' => $customer_address['address_format_id'], 'telephone' => $customer_address['customers_telephone'], 'email_address' => $customer_address['customers_email_address']);
     $this->delivery = array('firstname' => $shipping_address['entry_firstname'], 'lastname' => $shipping_address['entry_lastname'], 'company' => $shipping_address['entry_company'], 'street_address' => $shipping_address['entry_street_address'], 'city' => $shipping_address['entry_city'], 'postcode' => $shipping_address['entry_postcode'], 'state' => smn_not_null($shipping_address['entry_state']) ? $shipping_address['entry_state'] : $shipping_address['zone_name'], 'zone_id' => $shipping_address['entry_zone_id'], 'country' => array('id' => $shipping_address['countries_id'], 'title' => $shipping_address['countries_name'], 'iso_code_2' => $shipping_address['countries_iso_code_2'], 'iso_code_3' => $shipping_address['countries_iso_code_3']), 'country_id' => $shipping_address['entry_country_id'], 'format_id' => $shipping_address['address_format_id']);
     $this->billing = array('firstname' => $billing_address['entry_firstname'], 'lastname' => $billing_address['entry_lastname'], 'company' => $billing_address['entry_company'], 'street_address' => $billing_address['entry_street_address'], 'city' => $billing_address['entry_city'], 'postcode' => $billing_address['entry_postcode'], 'state' => smn_not_null($billing_address['entry_state']) ? $billing_address['entry_state'] : $billing_address['zone_name'], 'zone_id' => $billing_address['entry_zone_id'], 'country' => array('id' => $billing_address['countries_id'], 'title' => $billing_address['countries_name'], 'iso_code_2' => $billing_address['countries_iso_code_2'], 'iso_code_3' => $billing_address['countries_iso_code_3']), 'country_id' => $billing_address['entry_country_id'], 'format_id' => $billing_address['address_format_id']);
     $index = 0;
     /*Added the code for single checkout also,by Cimi*/
     if (ALLOW_STORE_PAYMENT == 'true') {
         $products = $cart->get_products($store_id);
     } else {
         $store_list = $cart->get_store_list();
         for ($k = 0; $k < sizeof($store_list); $k++) {
             $products = array_merge($products, $cart->get_products($store_list[$k]));
         }
     }
     /*End of code*/
     for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
         $this->products[$index] = array('qty' => $products[$i]['quantity'], 'name' => $products[$i]['name'], 'products_store_id' => $products[$i]['store_id'], 'model' => $products[$i]['model'], 'tax' => smn_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'tax_description' => smn_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'price' => $products[$i]['price'], 'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']), 'weight' => $products[$i]['weight'], 'id' => $products[$i]['id']);
         if ($products[$i]['attributes']) {
             $subindex = 0;
             reset($products[$i]['attributes']);
             while (list($option, $value) = each($products[$i]['attributes'])) {
                 $attributes_query = smn_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.store_id = '" . $store_id . "' and poval.store_id = '" . $store_id . "' and popt.store_id = '" . $store_id . "' and pa.products_id = '" . (int) $products[$i]['id'] . "' and pa.options_id = '" . (int) $option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int) $value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int) $languages_id . "' and poval.language_id = '" . (int) $languages_id . "'");
                 $attributes = smn_db_fetch_array($attributes_query);
                 $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'], 'value' => $attributes['products_options_values_name'], 'option_id' => $option, 'value_id' => $value, 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']);
                 $subindex++;
             }
         }
         $shown_price = $currencies->calculate_price($this->products[$index]['final_price'], $this->products[$index]['tax'], $this->products[$index]['qty']);
         $this->info['subtotal'] += $shown_price;
         $products_tax = $this->products[$index]['tax'];
         $products_tax_description = $this->products[$index]['tax_description'];
         if (DISPLAY_PRICE_WITH_TAX == 'true') {
             $this->info['tax'] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             }
         } else {
             $this->info['tax'] += $products_tax / 100 * $shown_price;
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $products_tax / 100 * $shown_price;
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $products_tax / 100 * $shown_price;
             }
         }
         $index++;
     }
     if (DISPLAY_PRICE_WITH_TAX == 'true') {
         $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
     } else {
         $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
     }
 }
Ejemplo n.º 24
0
 function calculate($store = '')
 {
     $this->total = 0;
     $this->weight = 0;
     if (!is_array($this->contents)) {
         return 0;
     }
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         $qty = $this->contents[$products_id]['qty'];
         // products price
         $product_query = smn_db_query("select products_id, store_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int) $products_id . "'");
         if ($product = smn_db_fetch_array($product_query)) {
             $products_id = smn_get_uprid($products_id, $attributes);
             $products_store_id = $product['store_id'];
             $products_tax = smn_get_tax_rate($product['products_tax_class_id']);
             $products_price = $product['products_price'];
             $products_weight = $product['products_weight'];
             $specials_query = smn_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int) $prid . "' and status = '1' and store_id = '" . $products_store_id . "'");
             if (smn_db_num_rows($specials_query)) {
                 $specials = smn_db_fetch_array($specials_query);
                 $products_price = $specials['specials_new_products_price'];
             }
             if (isset($store) && $store != '') {
                 if ($products_store_id == $store) {
                     $this->total += smn_add_tax($products_price, $products_tax) * $qty;
                     $this->weight += $qty * $products_weight;
                 }
             } else {
                 $this->total += smn_add_tax($products_price, $products_tax) * $qty;
                 $this->weight += $qty * $products_weight;
             }
         }
         // attributes price
         if (isset($this->contents[$products_id]['attributes'])) {
             reset($this->contents[$products_id]['attributes']);
             while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
                 $attribute_price_query = smn_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int) $prid . "' and options_id = '" . (int) $option . "' and store_id = '" . $products_store_id . "' and options_values_id = '" . (int) $value . "'");
                 $attribute_price = smn_db_fetch_array($attribute_price_query);
                 if ($attribute_price['price_prefix'] == '+') {
                     $this->total += $qty * smn_add_tax($attribute_price['options_values_price'], $products_tax);
                 } else {
                     $this->total -= $qty * smn_add_tax($attribute_price['options_values_price'], $products_tax);
                 }
             }
         }
     }
 }
Ejemplo n.º 25
0
 function process_button()
 {
     global $customer_id, $order, $languages_id, $currencies, $currency, $cart_PayPal_IPN_ID, $shipping, $store;
     if (MODULE_PAYMENT_PAYPAL_IPN_CURRENCY == 'Selected Currency') {
         $my_currency = $currency;
     } else {
         $my_currency = substr(MODULE_PAYMENT_PAYPAL_IPN_CURRENCY, 5);
     }
     if (!in_array($my_currency, array('AUD', 'CAD', 'CHF', 'CZK', 'DKK', 'EUR', 'GBP', 'HKD', 'HUF', 'JPY', 'NOK', 'NZD', 'PLN', 'SEK', 'SGD', 'USD'))) {
         $my_currency = 'USD';
     }
     $parameters = array();
     if (MODULE_PAYMENT_PAYPAL_IPN_TRANSACTION_TYPE == 'Per Item' && MODULE_PAYMENT_PAYPAL_IPN_EWP_STATUS == 'False') {
         $parameters['cmd'] = '_cart';
         $parameters['upload'] = '1';
         for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
             $item = $i + 1;
             $tax_value = $order->products[$i]['tax'] / 100 * $order->products[$i]['final_price'];
             $parameters['item_name_' . $item] = $order->products[$i]['name'];
             $parameters['amount_' . $item] = number_format($order->products[$i]['final_price'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
             $parameters['tax_' . $item] = number_format($tax_value * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
             $parameters['quantity_' . $item] = $order->products[$i]['qty'];
             if ($i == 0) {
                 if (DISPLAY_PRICE_WITH_TAX == 'true') {
                     $shipping_cost = $order->info['shipping_cost'];
                 } else {
                     $module = substr($shipping['id'], 0, strpos($shipping['id'], '_'));
                     $shipping_tax = smn_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
                     $shipping_cost = $order->info['shipping_cost'] + smn_calculate_tax($order->info['shipping_cost'], $shipping_tax);
                 }
                 $parameters['shipping_' . $item] = number_format($shipping_cost * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
             }
             if (isset($order->products[$i]['attributes'])) {
                 for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                     if (DOWNLOAD_ENABLED == 'true') {
                         $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename\n                                     from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n                                     left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n                                     on pa.products_attributes_id=pad.products_attributes_id\n                                     where pa.products_id = '" . $order->products[$i]['id'] . "'\n                                     and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n                                     and pa.options_id = popt.products_options_id\n                                     and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n                                     and pa.options_values_id = poval.products_options_values_id\n                                     and popt.language_id = '" . $languages_id . "'\n                                     and poval.language_id = '" . $languages_id . "'";
                         $attributes = smn_db_query($attributes_query);
                     } else {
                         $attributes = smn_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
                     }
                     $attributes_values = smn_db_fetch_array($attributes);
                     // Unfortunately PayPal only accepts two attributes per product, so the
                     // third attribute onwards will not be shown at PayPal
                     $parameters['on' . $j . '_' . $item] = $attributes_values['products_options_name'];
                     $parameters['os' . $j . '_' . $item] = $attributes_values['products_options_values_name'];
                 }
             }
         }
         $parameters['num_cart_items'] = $item;
         if (MOVE_TAX_TO_TOTAL_AMOUNT == 'True') {
             // PandA.nl move tax to total amount
             $parameters['amount'] = number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
         } else {
             // default
             $parameters['amount'] = number_format(($order->info['total'] - $order->info['shipping_cost'] - $order->info['tax']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
         }
     } else {
         $parameters['cmd'] = '_ext-enter';
         $parameters['redirect_cmd'] = '_xclick';
         $parameters['item_name'] = STORE_NAME;
         $parameters['shipping'] = '0';
         if (MOVE_TAX_TO_TOTAL_AMOUNT == 'True') {
             // PandA.nl move tax to total amount
             $parameters['amount'] = number_format($order->info['total'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
         } else {
             // default
             $parameters['amount'] = number_format(($order->info['total'] - $order->info['tax']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
         }
     }
     // billing information fix by gravyface
     // for pre-populating the fiels if customer has no PayPal account
     // only works if force shipping address is set to FALSE
     $state_abbr = smn_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']);
     $name = $order->delivery['firstname'] . ' ' . $order->delivery['lastname'];
     $parameters['business'] = MODULE_PAYMENT_PAYPAL_IPN_ID;
     // let's check what has been defined in the shop admin for the shipping address
     if (MODULE_PAYMENT_PAYPAL_IPN_SHIPPING == 'True') {
         // all that matters is that we send the variables
         // what they contain is irrelevant as PayPal overwrites it with the customer's confirmed PayPal address
         // so what we send is probably not what we'll get back
         $parameters['no_shipping'] = '2';
         $parameters['address_name'] = $name;
         $parameters['address_street'] = $order->delivery['street_address'];
         $parameters['address_city'] = $order->delivery['city'];
         $parameters['address_zip'] = $order->delivery['postcode'];
         $parameters['address_state'] = $state_abbr;
         $parameters['address_country_code'] = $order->delivery['country']['iso_code_2'];
         $parameters['address_country'] = $order->delivery['country']['title'];
         $parameters['payer_email'] = $order->customer['email_address'];
     } else {
         $parameters['no_shipping'] = '1';
         $parameters['H_PhoneNumber'] = $order->customer['telephone'];
         $parameters['first_name'] = $order->delivery['firstname'];
         $parameters['last_name'] = $order->delivery['lastname'];
         $parameters['address1'] = $order->delivery['street_address'];
         $parameters['address2'] = $order->delivery['suburb'];
         $parameters['city'] = $order->delivery['city'];
         $parameters['zip'] = $order->delivery['postcode'];
         $parameters['state'] = $state_abbr;
         $parameters['country'] = $order->delivery['country']['iso_code_2'];
         $parameters['email'] = $order->customer['email_address'];
     }
     $parameters['currency_code'] = $my_currency;
     $parameters['invoice'] = substr($cart_PayPal_IPN_ID, strpos($cart_PayPal_IPN_ID, '-') + 1);
     $parameters['custom'] = $customer_id;
     $parameters['no_note'] = '1';
     $parameters['notify_url'] = smn_href_link('ext/modules/payment/paypal_ipn/ipn.php', '', 'NONSSL', false, false);
     $parameters['cbt'] = CONFIRMATION_BUTTON_TEXT;
     $parameters['return'] = smn_href_link(FILENAME_CHECKOUT_PROCESS, 'ID=' . $store->get_store_id(), 'NONSSL');
     $parameters['cancel_return'] = smn_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'NONSSL');
     $parameters['bn'] = $this->identifier;
     $parameters['lc'] = $order->customer['country']['iso_code_2'];
     if (smn_not_null(MODULE_PAYMENT_PAYPAL_IPN_PAGE_STYLE)) {
         $parameters['page_style'] = MODULE_PAYMENT_PAYPAL_IPN_PAGE_STYLE;
     }
     if (MODULE_PAYMENT_PAYPAL_IPN_EWP_STATUS == 'True') {
         $parameters['cert_id'] = MODULE_PAYMENT_PAYPAL_IPN_EWP_CERT_ID;
         $random_string = rand(100000, 999999) . '-' . $customer_id . '-';
         $data = '';
         while (list($key, $value) = each($parameters)) {
             $data .= $key . '=' . $value . "\n";
         }
         $fp = fopen(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt', 'w');
         fwrite($fp, $data);
         fclose($fp);
         unset($data);
         if (function_exists('openssl_pkcs7_sign') && function_exists('openssl_pkcs7_encrypt')) {
             openssl_pkcs7_sign(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt', MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_PUBLIC_KEY), file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_PRIVATE_KEY), array('From' => MODULE_PAYMENT_PAYPAL_IPN_ID), PKCS7_BINARY);
             unlink(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt');
             // remove headers from the signature
             $signed = file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');
             $signed = explode("\n\n", $signed);
             $signed = base64_decode($signed[1]);
             $fp = fopen(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', 'w');
             fwrite($fp, $signed);
             fclose($fp);
             unset($signed);
             openssl_pkcs7_encrypt(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt', file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_PAYPAL_KEY), array('From' => MODULE_PAYMENT_PAYPAL_IPN_ID), PKCS7_BINARY);
             unlink(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');
             // remove headers from the encrypted result
             $data = file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
             $data = explode("\n\n", $data);
             $data = '-----BEGIN PKCS7-----' . "\n" . $data[1] . "\n" . '-----END PKCS7-----';
             unlink(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
         } else {
             exec(MODULE_PAYMENT_PAYPAL_IPN_EWP_OPENSSL . ' smime -sign -in ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt -signer ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_PUBLIC_KEY . ' -inkey ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_PRIVATE_KEY . ' -outform der -nodetach -binary > ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');
             unlink(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt');
             exec(MODULE_PAYMENT_PAYPAL_IPN_EWP_OPENSSL . ' smime -encrypt -des3 -binary -outform pem ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_PAYPAL_KEY . ' < ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt > ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
             unlink(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');
             $fh = fopen(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt', 'rb');
             $data = fread($fh, filesize(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt'));
             fclose($fh);
             unlink(MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
         }
         $process_button_string = smn_draw_hidden_field('cmd', '_s-xclick') . smn_draw_hidden_field('encrypted', $data);
         unset($data);
     } else {
         while (list($key, $value) = each($parameters)) {
             echo smn_draw_hidden_field($key, $value);
         }
     }
     return $process_button_string;
 }
Ejemplo n.º 26
0
    echo SITE_THEMA;
    ?>
/infobox/background_main.gif" width="100%" class="infoBoxHeading"><?php 
    echo $default_specials['products_name'];
    ?>
                        </td>
                        <td class="infoBoxHeading" nowrap>
                        <img src="includes/classes/thema/<?php 
    echo SITE_THEMA;
    ?>
/infobox/corner_right_left.gif" border="0" ></td>
                      </tr>
                    </table>
<?php 
    $default_specials['products_description'] = smn_get_products_description($default_specials['products_id']);
    $default_specials['products_name'] = smn_get_products_name($default_specials['products_id']);
    $info_box_contents[] = array('align' => 'center', 'text' => '<a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $default_specials['products_id'] . '&ID=' . $default_specials['store_id']) . '">' . smn_image(DIR_WS_CATALOG_IMAGES . $default_specials['products_image'], $default_specials['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td><td><a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $default_specials['products_id']) . '"></a></td><td align="center"><s>' . $currencies->display_price($default_specials['products_price'], smn_get_tax_rate($default_specials['products_tax_class_id'], '', '', $default_specials['store_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($default_specials['specials_new_products_price'], smn_get_tax_rate($default_specials['products_tax_class_id'], '', '', $default_specials['store_id'])) . '</span><br><br><a href="' . smn_href_link(basename($PHP_SELF), smn_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $default_specials['products_id'], 'NONSSL') . '">' . smn_image_button('button_buy_now.gif') . '</a>&nbsp;<br></td><tr><td colspan="3" align="top" valign="top" height="100">' . osc_trunc_string(strip_tags($default_specials['products_description'])) . '<br><br><a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $default_specials['products_id']) . '">More Info...</a>
    ');
    new infoBox($info_box_contents);
    $info_box_contents = array();
    $info_box_contents[] = array('align' => 'left', 'text' => ' ');
    new infoBoxDefault($info_box_contents, true, true);
    $count++;
    if ($count > 1) {
        $count = 0;
        echo '</tr><tr>';
    }
}
?>
</tr></table></td></tr>
<!-- default_specials_eof //-->
Ejemplo n.º 27
0
    echo smn_draw_separator('pixel_trans.gif', '100%', '10');
    ?>
</td>
      </tr>
<?php 
}
?>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
<?php 
$row = 0;
$specials_query = smn_db_query($specials_split->sql_query);
while ($specials = smn_db_fetch_array($specials_query)) {
    $row++;
    echo '            <td align="center" width="33%" class="smallText"><a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . smn_image(DIR_WS_IMAGES . $specials['products_image'], $specials['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . $specials['products_name'] . '</a><br><s>' . $currencies->display_price($specials['products_price'], smn_get_tax_rate($specials['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($specials['specials_new_products_price'], smn_get_tax_rate($specials['products_tax_class_id'])) . '</span></td>' . "\n";
    if ($row / 3 == floor($row / 3)) {
        ?>
          </tr>
          <tr>
            <td><?php 
        echo smn_draw_separator('pixel_trans.gif', '100%', '10');
        ?>
</td>
          </tr>
          <tr>
<?php 
    }
}
?>
          </tr>