Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

X-Configurator => with a base Price+base Weight+base etc.

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 12-09-2005, 09:10 AM
 
tomazws tomazws is offline
 

Member
  
Join Date: Jan 2005
Location: Walnut, California
Posts: 16
 

Default X-Configurator => with a base Price+base Weight+base etc.

Got it working, implemented into with all these other changes our client requested for. I'm sorry that I cannot disclose the link of the website.

Here's the basic idea of the changes. I'm not good at writing tutorials.... So for more details, you'd prolly have to figure it out yourself

This sloppy little guide will be applied on X-Cart Gold v.4.0.14.

----------------------------------------

Let's talk about the check out first:

First, we need X-Cart to do shipping calculation on all configurator products (Base product). So, open up func.php, look for the function listed below, and replace the commented out code, with the line of code right below it.

Code:
function func_calculate_shippings($products, $shipping_id, $customer_info, $provider="") { . . . // if ($product["free_shipping"] == "Y" || $product['product_type'] == 'C') if ($product["free_shipping"] == "Y") . . .

Add a base price for the configurator product. Needs to change 2 functions under func.php

Code:
function func_calculate_single($cart, $products, $login, $login_type, $provider_for="") { . . . //$product["pconf_price"] = $product["price"] = max(doubleval($product["options_surcharge"]), 0); $product["pconf_price"] = $product["price"] = $product["price"] + max(doubleval($product["options_surcharge"]), 0); . . .

Code:
function func_products_from_scratch($scratch_products, $membership, $persistent_products) { . . . /* if ($products_array["product_type"] == "C") $products_array["price"] = $products_array["options_surcharge"]; else $products_array["price"] += $products_array["options_surcharge"]; */ $products_array["price"] += $products_array["options_surcharge"]; . . .

Now the Configurator Product has a regular product's price and weight, it'll add up to the total, apply tax, and all other stuff automatically. Please edit all the *.tpl's (example: cart_details.tpl) so that the Configurator Product will also show its price/weight.

But...
what's the point of having a base price and a base weight, when you can't even type them in on our back-end?!?!?!

First, implement all the form fields from skin1/main/product_details.tpl to skin1/modules/Product_Configurator/product_details.tpl... like "price", weight, this that... bla bla bla... so you could at least enter a price and weight to the Configurator Product.

then, we'll need to edit a PHP file so that X-Cart could record the price and weight and other stuff into the database.

Under modules/Product_Configurator/product_modify.php:

X-Cart insert '0' as price for the C-Product. We want OUR own price:
Code:
. . . //db_query("INSERT INTO $sql_tbl[pricing] (productid, quantity, price) VALUES ('$productid', '1', '0')"); //REPLACE THIS LINE db_query("INSERT INTO $sql_tbl[pricing] (productid, quantity, price) VALUES ('$productid', '1', '".abs($price)."')"); //WITH THIS LINE. . . .

X-Cart doesn't update price, doesn't update weight, quantity... etc. But we would like to be able to: (put the following code right under, or right above where X-Cart updates the images. So that X-Cart will also update price and weight and etc.)
Code:
# # Update existing product # db_query("UPDATE $sql_tbl[pricing] SET price='$price' WHERE productid='$productid' AND quantity='1' AND membership='' AND $sql_tbl[pricing].variantid = 0"); if($fields['price'] == 'Y' && $productids) db_query("UPDATE $sql_tbl[pricing] SET price='$price' WHERE quantity='1' AND $sql_tbl[pricing].variantid = 0 AND membership=''".$products_condition);

and then.. replace the following commented out line (the first line) with the junk below:
Code:
. . . //db_query("UPDATE $sql_tbl[products] SET product='$product', descr='$descr', fulldescr='$fulldescr', avail='1', list_price='0.00', weight='0', productcode='$productcode', forsale='$forsale', min_amount='$min_amount' WHERE productid='$productid'"); # Correct the min_amount if (empty($min_amount) or intval($min_amount) == 0) $min_amount = 1; # # Update product data # db_query("UPDATE $sql_tbl[products] SET product='$product', descr='$descr', fulldescr='$fulldescr', avail='$avail', list_price='$list_price', cost='$cost', weight='$weight', productcode='$productcode', forsale='$forsale', distribution='$distribution', free_shipping='$free_shipping', shipping_freight='$shipping_freight', discount_avail='$discount_avail', min_amount='$min_amount', return_time = '$return_time', low_avail_limit='$low_avail_limit', free_tax='$free_tax' WHERE productid='$productid'"); if($image_posted && !empty($image_data)) { db_query("UPDATE $sql_tbl[products] SET image_x='$image_data[image_x]', image_y='$image_data[image_y]' WHERE productid='$productid'"); } db_query("DELETE FROM $sql_tbl[product_taxes] WHERE productid='$productid'"); if($productids && $fields['taxes']) db_query("DELETE FROM $sql_tbl[product_taxes] WHERE productid IN ('".implode("','", array_keys($productids))."')"); if (!empty($taxes) and is_array($taxes)) { foreach ($taxes as $k=>$v) { if (intval($v) > 0) { db_query("REPLACE INTO $sql_tbl[product_taxes] (productid, taxid) VALUES ('$productid', '".intval($v)."')"); if($productids && $fields['taxes']) { foreach($productids as $pid => $v2) db_query("REPLACE INTO $sql_tbl[product_taxes] (productid, taxid) VALUES ('$pid', '".intval($v)."')"); } } } } if ($productids && $fields) { $tmp = array(); foreach($fields as $k => $v) { if(!in_array($k, array("efields", "price", "thumbnail", "categoryid", "categoryids", "taxes"))) { $tmp[] = $k.'="'.$$k.'"'; } } if($tmp) db_query("UPDATE $sql_tbl[products] SET ".implode(", ", $tmp)." WHERE 1".$products_condition); } if ($active_modules["Extra_Fields"]) { include $xcart_dir."/modules/Extra_Fields/extra_fields_modify.php"; }
__________________
-Thomas
Design Range
thomas@designrange.com
http://www.designrange.com
Reply With Quote
  #2  
Old 02-09-2006, 03:52 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Moving to Custom Mods
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 04-23-2006, 04:57 PM
 
subzero subzero is offline
 

eXpert
  
Join Date: Mar 2005
Posts: 238
 

Default

great mod just what i was looking for
tried it and it works great!!!
__________________
Version 4.0.17
Reply With Quote
  #4  
Old 11-16-2007, 10:17 AM
 
VmarkJon VmarkJon is offline
 

Newbie
  
Join Date: Oct 2007
Posts: 6
 

Default Re: X-Configurator => with a base Price+base Weight+base etc.

I'm using x-cart-4.1.9 gold and I can't find any of this code. When you say, "open up func.php" which func.php do you mean?
__________________
Jon
x-cart-4.1.11gold
Reply With Quote
  #5  
Old 11-18-2007, 08:43 PM
 
intel352 intel352 is offline
 

X-Wizard
  
Join Date: Dec 2005
Posts: 1,071
 

Default Re: X-Configurator => with a base Price+base Weight+base etc.

X-Cart 4.1 is greatly different from X-Cart 4.0. You'll need to search files in the include/func/ folder.
__________________
-Jon Langevin
WARNING: Unethical developer - NOT RECOMMENDED
See details here
Reply With Quote
  #6  
Old 01-27-2008, 07:43 PM
 
fivestar fivestar is offline
 

Member
  
Join Date: Oct 2007
Posts: 18
 

Default Re: X-Configurator => with a base Price+base Weight+base etc.

Has anyone tried this mod in 4.19? I'm attempting to do it but not sure exactly where to start?

Greg
__________________
Greg Hodges
ProDJpc
XCart Gold 4.1.9
Windows XP Pro
Reply With Quote
  #7  
Old 02-20-2008, 12:51 PM
 
jwiegand jwiegand is offline
 

Newbie
  
Join Date: Feb 2008
Posts: 4
 

Default Re: X-Configurator => with a base Price+base Weight+base etc.

I think there are a number of us that could use this mod rewritten for 4.1.9. I'm looking at it now, and while the code is similar - it's different enough that a little bit more experienced help would be useful

Any help?
__________________
Version 4.1.9
Reply With Quote
  #8  
Old 06-16-2008, 07:40 AM
 
BodyBalance BodyBalance is offline
 

Advanced Member
  
Join Date: Apr 2008
Posts: 44
 

Default Re: X-Configurator => with a base Price+base Weight+base etc.

Anyone have an update on this?
__________________
Version 4.1.9
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:03 AM.

   

 
X-Cart forums © 2001-2020