Hello, le price sheduler je sais pas trop a quelle contrib il correspond, c'est pas ma boutique. Je te colle ci dessous le shopping_cart.php et includes/classes/shopping_cart.php.
Merci de ton aide
shopping_cart.php
CODE
<?php
/*
$Id: shopping_cart.php,v 1.73 2003/06/09 23:03:56 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
require("includes/application_top.php");
//rmh M-S_pricing begin
// if the customer is not logged on AND don't display prices to visitors is selected,
// redirect them to the login page
if (!tep_session_is_registered('customer_id') && (VISITOR_PRICING_GROUP < '0')) {
$navigation->set_snapshot();
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}
//rmh M-S_pricing end
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOPPING_CART);
$breadcrumb->add(NAvb script:popup2=window.open(\'popup_ecotax.php?rate='.$ecotax_rates_id.'\',\'popup2\',\'scrollbars,resizable,width=625,height=500,left=50,top=50\'); popup2.focus(); return false;"><font color="blue"><u>[info]</u></font></a></div>';}
else {if ($ecotax_rates_id!="0"){
$product_info_ecotax=tep_get_ecotax_description($ecotax_rates_id);
$products_name.='<div align="left"><img src="/images/ecotaxe_on.jpg" border="0" height="15" align="absmiddle"> <nobr><small>Ecotaxe non incluse<br> Catégorie '.$product_info_ecotax[0]['code'].' '.'<a style="cursor: pointer; cursor: hand;" onclick="java script:popup2=window.open(\'popup_ecotax.php?rate='.$idcotaxe.'\',\'popup2\',\'scrollbars,resizable,width=625,height=500,left=50,top=50\'); popup2.focus(); return false;"><font color="blue"><u>[info]</u></font></a></div>';}
}}
$products_name .= ' </td>' .
' </tr>' .
'</table>';
$info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"',
'text' => $products_name);
//fin modif by paddybl for ecotax
$info_box_contents[$cur_row][] = array('align' => 'center',
'params' => 'class="productListing-data" valign="top"',
'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));
//debut modif by paddybl for ecotax
if (MODULE_ORDER_TOTAL_ECOTAX_INCLUDE=="True" && !$products[$i]['ecotax_rates_id']=="0"){
$info_box_contents[$cur_row][] = array('align' => 'right',
'params' => 'class="productListing-data" valign="top"',
'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']),$ecotax_rates_id, $products[$i]['quantity']) . '</b>');}
else
{ if ($products[$i]['ecotax_rates_id']!="0"){
$text_break="";
for($k=0;$k<$num_break;$k++){$text_break.="<br>";}
$add_ecotax_price=$text_break.'<nobr>+'.$currencies->display_price(tep_get_ecotax_price_value($ecotax_rates_id),tep_get_ecotax_rate( $ecotax_rates_id),0, $products[$i]['quantity']).'</nobr>';}else{$add_ecotax_price="";}
$info_box_contents[$cur_row][] = array('align' => 'right',
'params' => 'class="productListing-data" valign="top"',
'text' => '<b><nobr>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']),0, $products[$i]['quantity']) . '</nobr></b>'.$add_ecotax_price);}
$mao=mysql_result(tep_db_query("select * from products where products_id=".$products[$i]['id']),0,'products_make_an_offer');
if(TYPE_SITE=='pro'&&$propos)
if($mao)
$info_box_contents[$cur_row][] = array('align' => 'right',
'params' => 'class="productListing-data" valign="top"',
'text' => '<b>' . tep_draw_input_field('cart_prop[]',round($products[$i]['final_price']*1.196,2), 'size="8"'));
else
{
$info_box_contents[$cur_row][] = array('align' => 'right',
'params' => 'class="productListing-data" valign="top"',
'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) .tep_draw_hidden_field('cart_prop[]', $products[$i]['final_price']). '</b>');
}
}
new productListingBox($info_box_contents);
?>
</td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td align="right" class="main"><b><?php echo SUB_TITLE_SUB_TOTAL;?>
<?php echo $currencies->display_price($cart->show_total(),0);?></b></td>
</tr>
<?php
if ($any_out_of_stock == 1) {
if (STOCK_ALLOW_CHECKOUT == 'true') {
?>
<tr>
<td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></td>
</tr>
<?php
} else {
?>
<tr>
<td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></td>
</tr>
<?php
}
}
if(TYPE_SITE=='pro')
{
if (!$propos)
echo '<tr>
<td><a href='.FILENAME_SHOPPING_CART.'?propos=1>Proposer</td>
</tr>';
else
echo '<tr>
<td><a href=# onclick="document.cart_quantity.action=\'index.php?env_prop=1\';document.cart_quantity.submit()">Valider la proposition</td>
</tr>';
}
?>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<td class="main"><?php echo tep_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART); ?></td>
<?php
$back = sizeof($navigation->path)-2;
if (isset($navigation->path[$back])) {
?>
<td class="main"><?php echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?></td>
<?php
}
?>
<td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?></td>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<!-- BEGIN estimated shipping -->
<tr>
<td><br><?php include(DIR_WS_MODULES . FILENAME_ESTIMATED_SHIPPING); ?></td>
</tr>
<!-- END estimated shipping -->
</table></td>
</tr>
<?php
} else {
?>
<tr>
<td align="center" class="main"><?php new infoBox(array(array('text' => TEXT_CART_EMPTY))); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<?php
}
?>
</table></form></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
</tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
includes/classes/shopping_cart.php.
CODE
/*
$Id: shopping_cart.php,v 1.35 2003/06/25 21:14:33 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
class shoppingCart {
var $contents, $total, $weight, $cartID, $content_type;
function shoppingCart() {
$this->reset();
}
function restore_contents() {
// ############Added CCGV Contribution ##########
global $customer_id, $gv_id, $REMOTE_ADDR;
// global $customer_id;
// ############ End Added CCGV Contribution ##########
if (!tep_session_is_registered('customer_id')) return false;
// insert current cart contents in database
if (is_array($this->contents)) {
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$qty = $this->contents[$products_id]['qty'];
//rmh M-S_multi-stores edited next line
$product_query = tep_db_query("select cb.products_id from " . TABLE_CUSTOMERS_BASKET . " cb INNER JOIN " . TABLE_PRODUCTS_TO_STORES . " p2s ON cb.products_id = p2s.products_id AND cb.customers_basket_stores_id = p2s.stores_id where cb.customers_id = '" . (int)$customer_id . "' and cb.products_id = '" . tep_db_input($products_id) . "' and cb.customers_basket_stores_id = '" . STORES_ID . "'");
if (!tep_db_num_rows($product_query)) {
//rmh M-S_multi-stores edited next line
tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added, customers_basket_stores_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . $qty . "', '" . date('Ymd') . "', '" . STORES_ID . "')");
if (isset($this->contents[$products_id]['attributes'])) {
reset($this->contents[$products_id]['attributes']);
while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
//rmh M-S_multi-stores edited next line
tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, customers_basket_stores_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . STORES_ID . "', '" . tep_db_input($products_id) . "', '" . (int)$option . "', '" . (int)$value . "')");
}
}
} else {
//rmh M-S_multi-stores edited next line
tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . $qty . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "' and customers_basket_stores_id = '" . STORES_ID . "'");
}
}
// ############ Added CCGV Contribution ##########
if (tep_session_is_registered('gv_id')) {
$gv_query = tep_db_query("insert into " . TABLE_COUPON_REDEEM_TRACK . " (coupon_id, customer_id, redeem_date, redeem_ip) values ('" . $gv_id . "', '" . (int)$customer_id . "', now(),'" . $REMOTE_ADDR . "')");
$gv_update = tep_db_query("update " . TABLE_COUPONS . " set coupon_active = 'N' where coupon_id = '" . $gv_id . "'");
tep_gv_account_update($customer_id, $gv_id);
tep_session_unregister('gv_id');
}
// ############ End Added CCGV Contribution ##########
}
// reset per-session cart contents, but not the database contents
$this->reset(false);
//rmh M-S_multi-stores edited next line
$products_query = tep_db_query("select cb.products_id, cb.customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " cb INNER JOIN " . TABLE_PRODUCTS_TO_STORES . " p2s ON cb.products_id = p2s.products_id AND cb.customers_basket_stores_id = p2s.stores_id where cb.customers_id = '" . (int)$customer_id . "' and cb.customers_basket_stores_id = '" . STORES_ID . "'");
while ($products = tep_db_fetch_array($products_query)) {
$this->contents[$products['products_id']] = array('qty' => $products['customers_basket_quantity']);
// attributes
//rmh M-S_multi-stores edited next line
$attributes_query = tep_db_query("select products_options_id, products_options_value_id from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products['products_id']) . "' and customers_basket_stores_id = '" . STORES_ID . "'");
while ($attributes = tep_db_fetch_array($attributes_query)) {
$this->contents[$products['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];
}
}
$this->cleanup();
}
function reset($reset_database = false) {
global $customer_id;
$this->contents = array();
$this->total = 0;
$this->weight = 0;
$this->content_type = false;
if (tep_session_is_registered('customer_id') && ($reset_database == true)) {
//rmh M-S_multi-stores edited next 2 lines
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and customers_basket_stores_id = '" . STORES_ID . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and customers_basket_stores_id = '" . STORES_ID . "'");
}
unset($this->cartID);
if (tep_session_is_registered('cartID')) tep_session_unregister('cartID');
}
function add_cart($products_id, $qty = '1', $attributes = '', $notify = true) {
global $new_products_id_in_cart, $customer_id;
//rmh M-S_pricing begin
if (TYPE_SITE == 'pro') {
$pf = new PriceFormatter;
$pf->loadProduct($products_id);
$qty = $pf->adjustQty($qty); }
//rmh M-S_pricing end
$products_id_string = tep_get_uprid($products_id, $attributes);
$products_id = tep_get_prid($products_id_string);
if (is_numeric($products_id) && is_numeric($qty)) {
$check_product_query = tep_db_query("select products_status from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$check_product = tep_db_fetch_array($check_product_query);
if (($check_product !== false) && ($check_product['products_status'] == '1')) {
if ($notify == true) {
$new_products_id_in_cart = $products_id;
tep_session_register('new_products_id_in_cart');
}
if ($this->in_cart($products_id_string)) {
$this->update_quantity($products_id_string, $qty, $attributes);
} else {
$this->contents[$products_id_string] = array('qty' => $qty);
// insert into database //rmh M-S_multi-stores edited next line
if (tep_session_is_registered('customer_id') && $customer_id>0) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added, customers_basket_stores_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$qty . "', '" . date('Ymd') . "', '" . STORES_ID . "')");
// if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added, customers_basket_stores_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$qty . "', '" . date('Ymd') . "', '" . STORES_ID . "')");
if (is_array($attributes)) {
reset($attributes);
while (list($option, $value) = each($attributes)) {
$this->contents[$products_id_string]['attributes'][$option] = $value;
// insert into database //rmh M-S_multi-stores edited next line
if (tep_session_is_registered('customer_id') && $customer_id>0) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, customers_basket_stores_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . STORES_ID . "', '" . tep_db_input($products_id_string) . "', '" . (int)$option . "', '" . (int)$value . "')");
//if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, customers_basket_stores_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . STORES_ID . "', '" . tep_db_input($products_id_string) . "', '" . (int)$option . "', '" . (int)$value . "')");
}
}
}
// produit 423 limitation de l'achat a 1 piece
if (isset($this->contents[276])) {
$itgate = 'ok'; }
if ($this->in_cart($products_id)) {
//quantité 1 pour maxi pour le produit 423
if ($products_id == '423' and $itgate == 'ok') { $this->update_quantity(423, $quantity = '1', $attributes = '');
}
if ($products_id == '423' and $itgate != 'ok') { $this->update_quantity(423, $quantity =0, $attributes);
}
}
// produit 423 limitation de l'achat a 1 piece
$this->cleanup();
// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
$this->cartID = $this->generate_cart_id();
}
}
}
function update_quantity($products_id, $quantity = '', $attributes = '') {
global $customer_id;
$products_id_string = tep_get_uprid($products_id, $attributes);
$products_id = tep_get_prid($products_id_string);
if (is_numeric($products_id) && isset($this->contents[$products_id_string]) && is_numeric($quantity)) {
$this->contents[$products_id_string] = array('qty' => $quantity);
// update database
//rmh M-S_multi-stores edited next line
// if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . (int)$quantity . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "' and customers_basket_stores_id = '" . STORES_ID . "'");
if (tep_session_is_registered('customer_id') && $customer_id>0) tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . (int)$quantity . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "' and customers_basket_stores_id = '" . STORES_ID . "'");
if (is_array($attributes)) {
reset($attributes);
while (list($option, $value) = each($attributes)) {
$this->contents[$products_id_string]['attributes'][$option] = $value;
// update database
//rmh M-S_multi-stores edited next line
// if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "' and products_options_id = '" . (int)$option . "' and customers_basket_stores_id = '" . STORES_ID . "'");
if (tep_session_is_registered('customer_id') && $customer_id>0) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "' and products_options_id = '" . (int)$option . "' and customers_basket_stores_id = '" . STORES_ID . "'");
}
}
}
}
function cleanup() {
global $customer_id;
reset($this->contents);
while (list($key,) = each($this->contents)) {
if ($this->contents[$key]['qty'] < 1) {
unset($this->contents[$key]);
// remove from database
if (tep_session_is_registered('customer_id')) {
//rmh M-S_multi-stores edited next 2 lines
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($key) . "' and customers_basket_stores_id = '" . STORES_ID . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($key) . "' and customers_basket_stores_id = '" . STORES_ID . "'");
}
}
}
}
function count_contents() { // get total number of items in cart
$total_items = 0;
if (is_array($this->contents)) {
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$total_items += $this->get_quantity($products_id);
}
}
return $total_items;
}
function get_quantity($products_id) {
if (isset($this->contents[$products_id])) {
return $this->contents[$products_id]['qty'];
} else {
return 0;
}
}
function in_cart($products_id) {
if (isset($this->contents[$products_id])) {
return true;
} else {
return false;
}
}
function remove($products_id) {
global $customer_id;
unset($this->contents[$products_id]);
// remove from database
if (tep_session_is_registered('customer_id')) {
//rmh M-S_multi-stores edited next 2 lines
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "' and customers_basket_stores_id = '" . STORES_ID . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "' and customers_basket_stores_id = '" . STORES_ID . "'");
}
// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
$this->cartID = $this->generate_cart_id();
}
function remove_all() {
$this->reset();
}
function get_product_id_list() {
$product_id_list = '';
if (is_array($this->contents)) {
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$product_id_list .= ', ' . $products_id;
}
}
return substr($product_id_list, 2);
}
function calculate() {
if (TYPE_SITE == 'pro') { global $languages_id; }
$this->total = 0;
$this->weight = 0;
if (!is_array($this->contents)) return 0;
if (TYPE_SITE == 'pro') {
// *********************** Ajout PRO prix special par client *********************************************
global $customer_id;
$customer_group_query = tep_db_query("select customers_group_id from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");
$customer_group_id = tep_db_fetch_array($customer_group_query);
// *********************** FIN Ajout PRO prix special par client *********************************************
$pf = new PriceFormatter; }
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$qty = $this->contents[$products_id]['qty'];
// products price
if (TYPE_SITE == 'pro') {
// Prix site pro
if ($product = $pf->loadProduct($products_id, $languages_id)){
$prid = $product['products_id'];
$products_tax = tep_get_tax_rate($product['products_tax_class_id']);
$products_price = $pf->computePrice($qty); }
$products_weight = $product['products_weight'];
//******************** Ajout PRO Prix special par client **********************************
if ($customer_group_id['customers_group_id']>$products_price){
$customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $products_id . "' and customers_group_id = '" . $customer_group_id['customers_group_id'] . " and quant<=$qty'");
if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
$products_price = $customer_group_price['customers_group_price'];
}
}
//******************** FIN Ajout PRO Prix special par client **********************************
$specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1' AND (stores_id LIKE '%[" . STORES_ID . "]%')");
if (tep_db_num_rows ($specials_query)) {
$specials = tep_db_fetch_array($specials_query);
if ($specials['specials_new_products_price']&&$specials['specials_new_products_price']<$products_price)
$products_price = $specials['specials_new_products_price'];
}
$special_price = tep_get_products_special_price($products_id);
if ($special_price&&$special_price<$products_price) {
$products_price = $special_price;
}
$this->total += tep_add_tax($products_price, $products_tax) * $qty;
//debut modif by paddybl for ecotax
if (MODULE_ORDER_TOTAL_ECOTAX_STATUS=='true'){
$shown_price_with_ecotax = tep_add_ecotax(tep_add_tax($products_price, $products_tax) * $qty, tep_get_ecotax_rate($products_ecotax), $products_ecotax, $qty);
$this->total += $shown_price_with_ecotax;
}else{
$this->total += tep_add_tax($products_price, $products_tax) * $qty;
}
//fin modif by paddybl for ecotax
$this->weight += ($qty * $products_weight);
} else {
// fin Prix site pro
// Prix site non pro
//ligne suivante modif by paddybl for ecotax
$product_query = tep_db_query("select products_id, products_price, products_tax_class_id, ecotax_rates_id, products_weight from " . TABLE_PRODUCTS . " where products_id='" . (int)tep_get_prid($products_id) . "'");
if ($product = tep_db_fetch_array($product_query)) {
$prid = $product['products_id'];
$products_tax = tep_get_tax_rate($product['products_tax_class_id']);
//debut modif by paddybl for ecotax
$product_info_ecotax=tep_get_ecotax_description($product['ecotax_rates_id']);
$ecotax_rates_id=($product['ecotax_rates_id']!=$product_info_ecotax[0]['ecotax_id_other']&&$product_info_ecotax[0]['ecotax_id_other']!="")?$product_info_ecotax[0]['ecotax_id_other']:$product['ecotax_rates_id'];
$products_ecotax = $ecotax_rates_id;
//fin modif by paddybl for ecotax
$products_price = $product['products_price'];
$products_weight = $product['products_weight'];
global $customer_id;
$customer_group_query = tep_db_query("select customers_group_id from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");
$customer_group_id = tep_db_fetch_array($customer_group_query);
if ($customer_group_id['customers_group_id']>$products_price){
$customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $products_id . "' and customers_group_id = '" . $customer_group_id['customers_group_id'] . "'");
if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
$products_price = $customer_group_price['customers_group_price'];
}
}
$specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1' AND (stores_id LIKE '%[" . STORES_ID . "]%')");
if (tep_db_num_rows ($specials_query)) {
$specials = tep_db_fetch_array($specials_query);
$products_price = $specials['specials_new_products_price'];
}
$special_price = tep_get_products_special_price($products_id);
if ($special_price) {
$products_price = $special_price;
}
$this->total += tep_add_tax($products_price, $products_tax) * $qty;
$this->weight += ($qty * $products_weight);
}
}
// fin Prix site non pro
// 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 = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$prid . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
$attribute_price = tep_db_fetch_array($attribute_price_query);
if ($attribute_price['price_prefix'] == '+') {
$this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
} else {
$this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
}
&nbs
alsaco68
17 Jan 2007, 19:24
Pour info... je viens de rafaire l'installation complete...
Voici la seule partie du code que je n'ai pas pu mettre...
CODE
--------------------------------
vers ligne 3324 trouvez
--------------------------------
$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
--------------------------------
remplacer par
--------------------------------
//debut modif by paddybl for ecotax
$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id, ecotax_rates_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
//fin modif by paddybl for ecotax
--------------------------------
vers ligne 332 à 335 trouver
--------------------------------
if (tep_db_num_rows($specials_query)) {
$specials = tep_db_fetch_array($specials_query);
$products_price = $specials['specials_new_products_price'];
}
--------------------------------
ajouter en dessous
--------------------------------
//debut modif by paddybl
$product_info_ecotax=tep_get_ecotax_description($products['ecotax_rates_id']);
$ecotax_rates_id=($products['ecotax_rates_id']!=$product_info_ecotax[0]['ecotax_id_other']&& $product_info_ecotax[0]['ecotax_id_other']!="")?$product_info_ecotax[0]['ecotax_id_other']:$products['ecotax_rates_id'];
//fin modif by paddybl
La partie du code a modifier n'est pas gerée dans includes/classes/shopping_cart.php c'est commenté...
CODE
/* Handled in PriceFormatter
//rmh M-S_multi-stores edited next line
$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id, p.distributors_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd INNER JOIN " . TABLE_PRODUCTS_TO_STORES . " p2s ON p.products_id = p2s.products_id where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'AND p2s.stores_id = '" . STORES_ID . "'");
if ($products = tep_db_fetch_array($products_query)) {
$prid = $products['products_id'];
$products_price = $products['products_price'];
//rmh M-S_multi-stores edited next line
$specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " s where products_id = '" . (int)$prid . "' and status = '1' AND (s.stores_id = '" . STORES_ID . "')");
if (tep_db_num_rows($specials_query)) {
$specials = tep_db_fetch_array($specials_query);
$products_price = $specials['specials_new_products_price'];
}
*/
comme les commentaires l'indiquent, "Handled in PriceFormatter" j'en déduis que c'est geré par includes/classes/price_schedule.php qui fait sans doute partie de la contrib quantity Price breaks per product
http://www.oscommerce.com/community/contributions,1242 .
Le code correspond a ca un peu modifié...
paddybl
20 Jan 2007, 11:09
CITATION(pldtm @ 20 Jan 2007, 09:54) [snapback]217045[/snapback]
Merci pour cette contribution,
je sais pas si j'ai oublié une portion de code ou si c'est un bug mais quand j'enleve des categories d'ecotaxe dans la box lieux/taxes les taux restent toujours visible dans categorie sur une fiche article lorsque je veux attribuer un taux.
salut et merci
Pour comprendre, tu as supprimé une catégorie d'écotax dans lieux/Taxes=>catégorie écotaxe, puis tu vas sur une fiche produit dans l'admin et les taux sont toujours là! c'est cà!
Si oui, il faut considérer la situation sous plusieurs angles:
on peut dire qu'il sagit d'un bug en effet, car la suppression d'une catégorie devrait supprimer, tous les taux correspondant. la je suis d'accord.
Le souci par contre c'est que la suppression d'une catégorie et des taux correspondant ne doit ètrre faite que si aucune, et je dis bien aucune commande et aucun produit n'as utilisé et n'utilise ces taux et catégorie ! sinon tu te retrouves avec des incohérences sur les factures....
Je note un autre souci, là plus dans ton utilisation d'écotax:cas où l'on voit tous les taux(et même ceux qui devraient avoir disparu...) montre que tu n'as pas au préalable affecté de catégorie d'ecotax à la catégorie où tu as placé ton produit!
en cliquant sur éditer catégorie(je précise qu'il doit sagir de la catégorie ascendante directement la plus proche du produit), tu trouves une liste déroulante des différentes catégories d'écotax qui peuvent ètre appliqués aux produits contenus dans cette catégorie(de produit). de plus à cette endroit, tu as une case à cocher te permettant de choisir un taux à appliquer à tous les produits contenu dans cette catégorie en une seul fois ! Le fait d'appliquer une catégorie d'écotax à une catégorie de produit ne te renvoi dans la fiche produit que les taux applicables (et pas les 176 taux francais où 265 taux belges). c'est tous de même plus simple d'utilisation et celà ne t'aurait pas affiché les taux de la catégorie effacé.
Je comprend aussi que beaucoup seront tenté d'effacé ces taux et catégories qu'ils n'utiliseront sans doute jamais, je vais donc faire un correctif pour effacer en cascade ces taux lorsque l'on supprime une catégorie.
Bonjour,
merci pour cette information.
Dans le cas de l'utilisation de l'ecotaxe, pour le domaine qui m'interesse, effectivement je n'utiliserai qu'une, voir 2 categories d'ecotaxe. Je n'ai encore attribué aucune categorie a aucune categorie produit.
Mais le fait de vouloir supprimer des classes d'ecotaxe a plusieurs interets: d'abord eviter de possibles erreurs lors de la creation d'articles. Ensuite lors de la creation de la boutique la BDD sera petite mais a l'utilisation dans 1 an ou 2 elle risque de commencer a grossir.Donc autant ne pas la surcharger des le debut d'autant que c'est la premiere année d'existence de cette taxe, donc elle risque d'evoluer dans le nombre de categories et dans les classes en fonction des produits et j'ai pas envie d'avoir a tout modifier si jamais ils changent quelque chose (je sais je suis faineant).
Dans la pratique:
De plus je me suis rendu compte dans une boutique traditionnelle, que chaque constructeur attribue une ecotaxe en fonction de l'organisme auquel il a souscrit. si je fais de l'import c'est encore une taxe differente.
Ex: pour un ecran informatique de 19" , selon le constructeur ou que je l'achete en france ou en import, je vais avoir une taxe differente.
De plus en discutant avec un comptable il s'avere que cette taxe ne s'applique pas a tout le monde selon que vous etes consideré comme un particulier ou un professionnel, et dans les professionnels, certain doivent s'acquitter de cette taxe et d'autres non, donc purement dans un soucis de simplifier la gestion administrative par la suite je prefere au debut avoir le moins de taux et categorie d'ecotaxe possible.C'est vraiment le binz cette taxe, et je crois que les impots vont se régaler.
A l'utilisation de la contribution:
J'avais effectivement pas vu qu'en attribuant une categ. ecotaxe a une categ. produit cela faisait disparaitre les autres categorie au niveau du produit. Ce n'est donc pas un bug mais plutot un confort a l'usage.
Merci pour la modif.
pldtm
paddybl
21 Jan 2007, 11:34
Bonjour, et merci de ces précisions.
Je trouve en effet que c'est le bazarre c'est eco-participation. Lors que j'ai pris l'idée de concevoir ecotaxe pour la communauté, j'avais quelques peu anticipé les futures difficultés pour pouvoir jouer au maximum sur les catégories et les taux. Mais plus le temps passe et plus je parle avec diverses personnes, plus je me rends compte que les infos qu'on leurs communiquent sont différente d'une personnes à l'autres. j'ai l'impression que personnes ne sais (surtout les huiles de l'administration) comment on doit appliquer cette "taxes" (a ne surtout pas appeler taxes d'après la DGCCRF).
et dire, que je n'en ai pas besoin...
concernant l'import et l'export, je n'ai trouvé aucune info fiable sur la procédure à appliqué. d'ailleur je ne suis pas sur qu'ils savent comment faire eux aussi...
c'est clairement pas clair
ce que je sais c'est que depuis le 15 de l'année dernière celà devrait ètre en place, que la DGCCRF et conciliante pour l'instant, car eux non plus n'ont pas de consignes fiables, mais il finiront bien par ce réveiller. et comme à chaque fois, il faudra réagir à la derniére minute pour ce mettre en conformité....
je pense qu'ECOTAX permettre à chacun de s'adapter en ajoutant modifiant les taux et sous catégorie de taux pour leur cas particulier. le tous c'est que celà apparaisse sur la facture et dans la boutique.