close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Sizes option

Thread began 9/16/2009 4:01 pm by livforev259913 | Last modified 9/28/2009 2:57 pm by Jason Byrnes | 2872 views | 7 replies |

livforev259913

Sizes option

Hello, I have a size option in my cart but I do not know how to write the code in the calculations column or how to alter the recordsets. I am a novice with php and I am grateful for any help.

Sign in to reply to this post

Jason ByrnesWebAssist

Can you give some details on what it is you want to accomplish.

What do you want to do with the size options?

from your description it sounds like you have created the size list and the size is being passed to the cart successfully, is this correct?

Sign in to reply to this post

livforev259913

Sizes Option

Thank you Jason, I have a sizes list, each size with a different price, but when I choose a different size the relevant price is not passed on to the cart. Your help is much appreciated as I am new to php coding.

Sign in to reply to this post

Jason ByrnesWebAssist

do you have a database table that contains the price for the selected size, to perform a look up.

Or will the price always increment by a set amount for a size no mater what is ordered?


Say for example you have shirts.

Will a small be the base price, and medium increment by 1 dollar, larger by 2 etc... no matter which item is ordered?


I will need some more information on how you are setting this up to be able to assist.

Sign in to reply to this post

livforev259913

Sizes option

Here is an example of what i want to achieve www.bricabrac.me/ and the tables in my database
Database: `mario1`
--

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

--
-- Table structure for table `items_table`
--

CREATE TABLE IF NOT EXISTS `items_table` (
`Items_ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Items_Name` varchar(45) NOT NULL,
`Items_Thumbs` varchar(45) NOT NULL,
`Items_Description` varchar(45) NOT NULL,
PRIMARY KEY (`Items_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=18 ;

--
-- Dumping data for table `items_table`
--

INSERT INTO `items_table` (`Items_ID`, `Items_Name`, `Items_Thumbs`, `Items_Description`) VALUES
(1, 'Margherita', 'Pizza_1.jpg', ''),
(2, 'Milano', 'Pizza_2.jpg', ''),
(3, 'Hawaiin', 'Pizza_3.jpg', ''),
(4, 'Carabbean', 'Pizza_4.jpg', ''),
(5, 'Pollo', 'Pizza_5.jpg', ''),
(6, 'Yanks', 'Pizza_6.jpg', ''),
(7, 'Toscana', 'Pizza_7.jpg', ''),
(8, 'Mexican', 'Pizza_8.jpg', ''),
(9, 'Greek ', '', ''),
(10, 'Vegtarian', '', ''),
(11, 'American', '', ''),
(12, 'Four Seasons', '', ''),
(13, 'Garlic Pepperoni', '', ''),
(14, 'Mighty Meaty', '', ''),
(15, 'Sea Food', '', ''),
(16, 'Hot and Spicy', '', ''),
(17, 'Mario''s Special', '', '');





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

--
-- Table structure for table `price_table`
--

CREATE TABLE IF NOT EXISTS `price_table` (
`Items_ID` int(10) unsigned NOT NULL,
`Sizes_ID` int(11) DEFAULT NULL,
`Price` decimal(5,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `price_table`
--

INSERT INTO `price_table` (`Items_ID`, `Sizes_ID`, `Price`) VALUES
(1, 1, 2.50),
(1, 2, 3.99),
(1, 3, 6.50),
(1, 4, 9.20),
(2, 1, 3.00),
(2, 2, 5.50),
(2, 3, 7.90),
(2, 4, 9.99),
(3, 1, 3.00),
(3, 2, 5.50),
(3, 3, 7.90),
(3, 4, 9.99);

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

--
-- Table structure for table `sizes_table`
--

CREATE TABLE IF NOT EXISTS `sizes_table` (
`Sizes_ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Description` varchar(45) NOT NULL,
PRIMARY KEY (`Sizes_ID`),
UNIQUE KEY `Sizes_ID` (`Sizes_ID`),
UNIQUE KEY `Sizes_ID_2` (`Sizes_ID`),
UNIQUE KEY `Description` (`Description`),
UNIQUE KEY `Description_2` (`Description`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

--
-- Dumping data for table `sizes_table`
--

INSERT INTO `sizes_table` (`Sizes_ID`, `Description`) VALUES
(2, '10"'),
(3, '12"'),
(4, '14"'),
(1, '7"');


Thank you

Sign in to reply to this post

Jason ByrnesWebAssist

so, the size list should be set to use the sizes_table.Description as the label and sizes_table.Sizes_ID as the value.

you will need to create price lookup recordset to return the price and description for the selected size.


The add to cart form will have a hidden form element for the Item ID, and the Price select list. the names will be similar to:
Cartname_1_ID_Add
Cartname_1_Size_Add

you'll want to chaeck the add to cart form for the correct form element names. These will be used to filter the recoprdset.


The Recordset will be created using Advanced View.

Enter the following query in the SQL window:
SELECT price_table.Price, sizes_table.Description
FROM price_table
INNER JOIN sizes_table ON price_table.Sizes_ID = sizes_table.Sizes_ID
WHERE price_table.Items_ID = cartItem AND price_table.Sizes_ID = cartSize

In the Variables window, create the following 2 variables:
Name: cartItem
Type: Number
Default Value: -1
Run Time Value: $_POST['Cartname_1_ID_Add']

Name: cartSize
Type: Number
Default Value: -1
Run Time Value: $_POST['Cartname_1_Size_Add']

Remember, the names of the form elements may be slightly different, so make sure to use the correct form element names.

Sign in to reply to this post

livforev259913

Sizes Option

Thank you Jason.Work perfect I will probably will need more help as I develop this further.Your help is very much appreciated.

Sign in to reply to this post

Jason ByrnesWebAssist

Excellent, glad to hear it helped.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...