close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Product Batch Price updating Cart

Thread began 4/06/2016 11:05 pm by Kumel | Last modified 4/07/2016 9:00 pm by Ray Borduin | 416 views | 33 replies |

Kumel

Product Batch Price updating Cart

I got following tables: Products | ProductBatch

Product contains: ID, ProductName, CatID,
Product Batch contains, ID, ProductID, ProductPrice, ExpDate
Each product can have different batch of products so price do vary so price is added on product batch table.

Now on product detail page i got a ionSlider as to choose how many quantity of product is required.
Screenshots of eCart & ATC button attached.

When a product has only one batch then product with BatchName is found on cart.
But when there 2+ batches then when i choose a slider's quantity it doesn't add relevent quantity. But enter's other slider's values.

Why is this happening & how do we fix it?

Sign in to reply to this post

Kumel

i moved form within the repeat region.. seems to work. but is it safe?

Sign in to reply to this post

Kumel

Also how can we display message on cart if in this case the product quantity is out of stock.

I followed up using this: http://www.webassist.com/tutorials/Inventory-management-shopping-cart-IV

I tried a lot . but i think some changes are required in here:

$query_WADAProducts = sprintf("SELECT ProductStock - (SELECT Coalesce(SUM(DetailQuantity),0) FROM orders Inner Join orderdetails ON orderdetails.DetailOrderID = orders.OrderID WHERE OrderDate > ProductUpdateDate AND DetailProductID = ProductID) AS RemainingInventory FROM products WHERE ProductID = %s", GetSQLValueString($IDParam_WADAProducts, "int"));
$WADAProducts = mysql_query($query_WADAProducts, $Sample_Connection) or die(mysql_error());
$row_WADAProducts = mysql_fetch_assoc($WADAProducts);
$totalRows_WADAProducts = mysql_num_rows($WADAProducts);
?>




My tables are Products & ProducBatch
Product contains: ID, ProductName, CatID,
ProductBatch contains, ID, ProductID, ProductPrice, ExpDate, Quantity, BatchName.

Sign in to reply to this post

Kumel

i changed the sql to :

SELECT Quantity - (SELECT Coalesce(SUM(DetailQuantity),0) FROM ProductBatch, orders Inner Join orderdetails ON orderdetails.DetailOrderID = orders.OrderID WHERE OrderDate > ProductUpdateDate AND DetailProductID = Products.ID) AS RemainingInventory FROM products WHERE ProductID = %s

as my Quantity is present on ProductBatch table & column as Quantity.

But in cart i m getting error as : Unknown column 'Quantity' in 'field list'

Sign in to reply to this post

Ray BorduinWebAssist

What is the name of the quantity field in your products table? That error implies that it is not 'Quantity'.

Sign in to reply to this post

Kumel

There is no Quantity field in Products table. Quantity field is in ProducBatch.

ProductBatch contains : ID, ProductID, BatchName, Quantity, ExpDate & etc...

Sign in to reply to this post

Ray BorduinWebAssist

Quantity is in the outer Select statement which only returns results from the products table.

Your query is wrong and I could only guess without knowing your table structure.... Maybe what you are going for is:

SELECT Quantity - (SELECT Coalesce(SUM(DetailQuantity),0) FROM orders Inner Join orderdetails ON orderdetails.DetailOrderID = orders.OrderID WHERE OrderDate > ProductUpdateDate AND DetailProductID = Products.ID) AS RemainingInventory FROM products INNER JOIN ProductsBatch on products.ProductID = ProductsBatch.ProductID WHERE ProductID = %s

Sign in to reply to this post

Kumel

I have attached table structure of Products & ProductBatch.

After adding the sql product doesn't seem to add to cart at all. Cart is empty.
Cart.php also attached.

Sign in to reply to this post

Ray BorduinWebAssist

I'm afraid this is beyond what I can effectively do on this forum. I'd suggest a premier support ticket to look into this and help you write the proper SQL statement. I'm not even sure where and how this is all used or how it fits into your site... there is just too much custom research necessary to do effectively here.

Sign in to reply to this post

Kumel

Well cart was appearing empty dude to earlier test orders .

Your sql works awesomely. But Quantity not on proper product.

i added two product's batch in cart of same ProductID. But quantity ain't responding well in cart.

ProductBatch data attached. & also cart screenshot attached.
1 - BATCH: DSF234 Quantity : 500 it is valid in cart.
2 - BATCH: SNKFJ-12 Quantity: 123 it is not valid in cart. (displays 945)
3 - BATCH: XYZ Quantity : 945. (2,3 and same product but different batch products)

Sign in to reply to this post
loading

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...