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

Import product options

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 09-14-2003, 08:18 AM
  finestshops's Avatar 
finestshops finestshops is offline
 

eXpert
  
Join Date: Oct 2002
Location: Toronto, Canada
Posts: 335
 

Default Import product options

Here is my mod for batch upload of product options:

here is format of file for options import:

productcode, opttext, options

Code:
1044, Color, Black\r\nRed\r\nRoyal Blue 1044, Size, Regular\r\nXL 1068, Color, Black\r\nPeriwinkle\r\nWhite 1069, Color, Natural\r\nPurple\r\nTurquoise 1076, Color, Gold\r\nSilver 1076, Size, Regular\r\nXL 1139, Color, Black\r\nRed\r\nWhite 1139, Size, S\r\nM\r\nL 116, Color, Black\r\nWhite

create new file "xcart/provider/options_update.php"

Code:
<? /*****************************************************************************\ +-----------------------------------------------------------------------------+ | X-Cart | | Copyright (c) 2001-2003 Ruslan R. Fazliev <rrf@rrf.ru> | | All rights reserved. | +-----------------------------------------------------------------------------+ | PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" | | FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE | | AT THE FOLLOWING URL: http://www.x-cart.com/license.php | | | | THIS AGREEMENT EXPRESSES THE TERMS AND CONDITIONS ON WHICH YOU MAY USE | | THIS SOFTWARE PROGRAM AND ASSOCIATED DOCUMENTATION THAT RUSLAN R. | | FAZLIEV (hereinafter referred to as "THE AUTHOR") IS FURNISHING OR MAKING | | AVAILABLE TO YOU WITH THIS AGREEMENT (COLLECTIVELY, THE "SOFTWARE"). | | PLEASE REVIEW THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT | | CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE. BY INSTALLING, | | COPYING OR OTHERWISE USING THE SOFTWARE, YOU AND YOUR COMPANY | | (COLLECTIVELY, "YOU") ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS | | LICENSE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY THIS | | AGREEMENT, DO NOT INSTALL OR USE THE SOFTWARE. VARIOUS COPYRIGHTS AND | | OTHER INTELLECTUAL PROPERTY RIGHTS PROTECT THE SOFTWARE. THIS | | AGREEMENT IS A LICENSE AGREEMENT THAT GIVES YOU LIMITED RIGHTS TO USE | | THE SOFTWARE AND NOT AN AGREEMENT FOR SALE OR FOR TRANSFER OF TITLE.| | THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT. | | | | The Initial Developer of the Original Code is Ruslan R. Fazliev | | Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2003 | | Ruslan R. Fazliev. All Rights Reserved. | +-----------------------------------------------------------------------------+ \*****************************************************************************/ # # $Id: options_update.php,v 1 2003/09/10 ant Exp $ # # $columns[0] - productcode # $columns[1] - opttext # $columns[2] - options @set_time_limit(1800); require "../smarty.php"; require "../config.php"; require "./auth.php"; require "../include/security.php"; if ($REQUEST_METHOD=="POST") { $provider_condition=($single_mode?"":" AND $sql_tbl[products].provider='$login'"); if($fp = @fopen($userfile,"r")) { while ($columns = fgetcsv ($fp, 65536, $delimiter)) { if ($columns[0]) { if ($what == "p") { $pid = func_query_first ("SELECT * FROM $sql_tbl[products] WHERE productcode='$columns[0]' $provider_condition"); $f = "SELECT count(*) FROM $sql_tbl[product_options] WHERE productid='$pid[productid]' AND optclass='$columns[1]'"; echo $f." "; $tmp = array_pop(func_query_first($f)); # $tmp = db_query ($f); # echo $tmp." "; if ($tmp != 0) { $f = "UPDATE $sql_tbl[product_options] SET optclass='$columns[1]', opttext='$columns[1]', options='$columns[2]' WHERE productid='$pid[productid]'"; echo $f." "; db_query ($f); } else { $f = "INSERT $sql_tbl[product_options] VALUES ('','$pid[productid]','$columns[1]','$columns[1]','$columns[2]','0')"; echo $f." "; db_query ($f); } } } } $smarty->assign("main", "options_updated"); } else { $smarty->assign("main", "error_inv_update"); } } else { $smarty->assign ("main", "options_update"); } require "../include/categories.php"; @include "../modules/gold_display.php"; $smarty->display("provider/home.tpl"); ?>



create new template "\skin1\provider\main\options_update.tpl

Code:
{* $Id: options_update.tpl,v 1.0 2003/09/10 ant Exp $ *} {include file="location.tpl" last_location="Price update"} {capture name=dialog} <h3><font color=red>Script is in testing! Please back up database!</font></h3> <FORM method=POST action="options_update.php" enctype="multipart/form-data"> <TABLE border=0 cellpadding=0 cellspacing=4 width="100%"> <TR> <TD>Update</TD> <TD><SELECT name=what> <OPTION value="p" selected>Options</OPTION> </SELECT></TD> </TR> <TR> <TD>CSV delimiter</TD> <TD>{include file="provider/main/ie_delimiter.tpl"}</TD> </TR> <TR> <TD>CSV file</TD> <TD><INPUT type=file name=userfile></TD> </TR> <TR> <TD colspan=2><INPUT type=submit value="Update"> </TABLE> </FORM> {/capture} {include file="dialog.tpl" content=$smarty.capture.dialog title="Options Update" extra="width=100%"}

in template "\skin1\single\home.tpl"

after

Code:
{elseif $main eq "inv_update"} {include file="provider/main/inv_update.tpl"}

add

Code:
{elseif $main eq "options_update"} {include file="provider/main/options_update.tpl"}

in "\skin1\provider\menu.tpl"
after


add


The script will check if option is exist for productcode and update it
if yes or insert it if no.

I have similar script for price update by membership.

Hope this will help somebody,
__________________
Best regards,

Anton Pachkine
finestshops.com/x-cart
Reply With Quote
  #2  
Old 09-14-2003, 02:19 PM
 
ATKOgirl ATKOgirl is offline
 

X-Adept
  
Join Date: Sep 2002
Posts: 448
 

Default

Hi Anton,

Looks good! We'll give it a try on our next upload.

Thanks!

ATKOgirl
Reply With Quote
  #3  
Old 09-27-2003, 07:42 PM
 
dealsondeals dealsondeals is offline
 

eXpert
  
Join Date: Dec 2002
Location: Dallas, Texas, USA
Posts: 231
 

Default

Thanks!

I have implemented it and will test it over the next week.

Regards,

Glen
__________________
Never understimate stupidity.
--------
X-Cart Version: 3.5.2
Hosting:mind-in-design.net
Configuration: Virtual Dedicated Server || Intel Pentium 4 2.4 GHZ CPU || 1024MB PC2100 DDR RAM || Linux || PHP 4.3.2 || MySQL server 4.0.14
Reply With Quote
  #4  
Old 10-08-2003, 12:00 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

This functionality will be standard in version 3.5.x

Great mod though - looks like it would work well.
__________________
ex x-cart guru
Reply With Quote
  #5  
Old 10-08-2003, 06:02 AM
 
dealsondeals dealsondeals is offline
 

eXpert
  
Join Date: Dec 2002
Location: Dallas, Texas, USA
Posts: 231
 

Default

FunkyDunk,

Any preliminary estimates on a release date for version 3.5x?

Regards,

Glen
__________________
Never understimate stupidity.
--------
X-Cart Version: 3.5.2
Hosting:mind-in-design.net
Configuration: Virtual Dedicated Server || Intel Pentium 4 2.4 GHZ CPU || 1024MB PC2100 DDR RAM || Linux || PHP 4.3.2 || MySQL server 4.0.14
Reply With Quote
  #6  
Old 10-08-2003, 06:15 AM
  finestshops's Avatar 
finestshops finestshops is offline
 

eXpert
  
Join Date: Oct 2002
Location: Toronto, Canada
Posts: 335
 

Default

one of x-men told me it'll reliased be in a month (~)
__________________
Best regards,

Anton Pachkine
finestshops.com/x-cart
Reply With Quote
  #7  
Old 10-08-2003, 06:17 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

what do you call a deer that cant see?

dont think it will be long though - probably within the month is my guess.
__________________
ex x-cart guru
Reply With Quote
  #8  
Old 10-08-2003, 06:21 AM
 
dealsondeals dealsondeals is offline
 

eXpert
  
Join Date: Dec 2002
Location: Dallas, Texas, USA
Posts: 231
 

Default

In a month? Wow!

Are we looking at significant changes? Or just some additonal functionality like this?

Regards,

Glen
__________________
Never understimate stupidity.
--------
X-Cart Version: 3.5.2
Hosting:mind-in-design.net
Configuration: Virtual Dedicated Server || Intel Pentium 4 2.4 GHZ CPU || 1024MB PC2100 DDR RAM || Linux || PHP 4.3.2 || MySQL server 4.0.14
Reply With Quote
  #9  
Old 10-08-2003, 06:40 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

some good changes, but not change for the sake of it.
__________________
ex x-cart guru
Reply With Quote
  #10  
Old 11-04-2003, 11:40 AM
  lildawg's Avatar 
lildawg lildawg is offline
 

X-Adept
  
Join Date: Jan 2003
Location: Utah
Posts: 686
 

Default

Does this allow for when importing lets say a 1XL to still be able to add more money if that size is choosen? Example would be in x-cart adding a option I would put 1XL=+5 to add $5.00 to the base price if that is choosen. Has anyone done this yet and know?
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 02:36 PM.

   

 
X-Cart forums © 2001-2020