Reserve items in shopping cart - asp.net

Question has been asked with no answers over a month ago:
Shopping Cart reserve product
I have a shopping cart for my site in ASP.NET using SQL Server. When a user adds an item to the shopping cart I need to set a value in the product table to reserve the item (in order to avoid more people reserving the item, or buying it). Now, if the current user decides to abandon their cart by closing the browser, then how am I to restore the product record to being 'unreserved'?
Is there another way of reserving the item globally?

When a user "reserves" an item give the reservation an end date/time (e.g. DateTime.Now + 6 hrs, or whatever), by which they must have purchased the reserved item, otherwise after that date/time the reservation becomes void - I believe this is how the vast majority of bricks-and-mortar shops would work as well.
If you're worried about having a tbReservations table with loads of deprecated rows you can setup a SQL job to clear the table of old/invalid reservations each night or whenever is suitable for the business case.

Read the post by Benson Yu in this thread. In the Session_End method you can "unreserve" the products that were not checked out.

Related

Insert Discount - Coupon with SQL in NopCommerce

I do use nopCommerce 3.9 and I would like to insert coupon code from my C# program code. There are requirements such as "Has shopping cart amount" and "Blocked on product". The insert is working fine, I can see the inserted records and I think there are logically right. (The same process happening if I create Discount from Nop admin panel.)When I open the inserted coupon from Nop admin the "Discount info" tab is perfect, on the "Requirements" tab I see the requirements "Requirement Customer has x.xx amount in their shopping cart" and the "Requirement Block Discount on Product", but without value. If I modify the shopping cart value only (I don't modify the "blocked products" on purpose) and save it and reload the page, than everything is good. The blocked products are appeared too.
When I check the data tables I don't see any changes there. The records are the same as I inserted. I guess there is another table(s), where I have to update something, but I cannot find which one it is.
I would appreciate for any help.
From the comments, I believe OP want to insert the new discount rule with two things:
Cart has minimum total X.
Cart has specific product(s) Y.
And the issue is,
Its working properly if they apply discount rule from admin panel,
however, applying it programmatically couldn't store specific
products on a single call.
There are different tables for discount in nopCommerce.
Discount - main table
DiscountRequirement - stores requirement information
Discount_AppliedToProducts - stores discounted products information
Creating a discount rule first time will add entry in discount table only. Then the id of discount table will be used for reference to the DiscountRequirement and Discount_AppliedToProducts table.
It was everything good with my process. The issue was the nopCommerce cache. The nopCommerce keeps the discounts in cache. After I clear the cache I can see my values.
Thanks for everyone who tried to help or had a thought!

Customer segmentation price list does not work as expected in basket and checkout

The problem
We have created a customer segment and linked both a customer and a price list to this customer segment. The linked price list defines a special price of $5 for one of the products. This product has a 'default' price of $10.
When I login to the storefront with a user that belongs to customer segment, I see the correct price of $5 on the PDP. However once this product is added to the basket, it shows the 'default' product price of $10 in the minicart and on the cart page. I would expect to see $5 there as well.
Technical information
The (correct) price on the PDP is retrieved directly from the ProductBO by using the default ISProductPrice module which links to the default ProductPrice.isml.
<ISProductPrice
ProductBO="#ProductBO#"
Currency="#CurrentRequest:Currency#"
ShowInformationalPrice="true"
RichSnippetsEnabled="#RichSnippetsEnabled#"
>
The (wrong) price on the cart page is retrieved from the BasketComputedProductLineItemBO with the following (default ISH) code
<isif condition="#PriceDisplayType EQ 'net'#">
<isprint value="#PLI:SingleBasePriceNet#">
<iselse/>
<isprint value="#PLI:SingleBasePriceGross#">
</isif>
What I've tried so far
Clear cookies/cache to make sure we have a completely new basket
Made sure the Customer Segmentation Service is enabled (default ISH service).
Tried all the different methods to fetch a price from the BasketComputedProductLineItemBO
Added a couple of different products to the price list
Added a couple of different customers to the customer segment
Ran a search index
Tried to reproduce the issue on the ISH demo server
Checked the documentation on customer segmentation from the ISH support page
Tried to add a customer to the price list directly instead of a customer segment. When doing it this way, everything seems to work as expected.
At this point I'm completely stuck. Any help on how to go from here would be greatly appreciated.
Check this
https://support.intershop.com/kb/index.php/Display/IS-22923
If you search on segment on the support for version 7.9 then you get few bugs. Disable the dynamic segment service because it is buggy. See if that work or else i think you really do have a platform bug here.
Also a good idea to upgrade to the lastest minor version.

Microsoft Dynamics AX 2012 - Purchase Price

I've been instructed to create a customization on how the Unit Price (Purchline.PurchPrice) is calculated.
Right now when I'm creating a new purchase order and select an item, it simply pulls from the pricing from the released products for that particular item.
For my customization, I'm going to be using 3 variables to determine the pricing.
1: ItemId
2: Current Session Date
3: Customized Field in the Purchase Header
As such, I'll need access to purchline for the ItemId on the current line, and access to purchtable to access my field in the header.
Right now there is a big process for how the pricing gets pulled from released products, how the system checks for discounts, etc.
My question is, can anyone suggest the best class/location to check and modify where my final PurchPrice field gets set and inserted into purchline?
I need this to be basically the last part of the process of how this PurchPrice gets calculated. I've looked around in the PriceDisc & PriceConvert classes, SalesPurchLine map, the modified method of the ItemId field of the form.
AxPurchline doesn't seem to be triggering at all when I put breakpoints in them and create new purchase order lines.
Any help, insight or advice on where it would be the best to make logic changes for the PurchPrice field would be greatly appreciated.
Thanks in advance!
The table Purchline actually has a method called setPriceDisc where the price agreement is set and the line amount is adjusted.
This seems to be the last place where PurchLine.PurchPrice is set.

Using Firebase (NoSQL) for Inventory app is ACID or not?

I'm a newbie programmer.
I want to get experience using Firebase (Backend As A Service) which use JSON for storing data (I think they call this type of database a document database).
But my Inventory app has 3 main page which are add item, inventory and item sold.
Can this be done using This type of database? is it still ACID (Atomicity, Consistency, Isolation, Durability)?
add item page would have {product name, date added, amount added}
Inventory page would have {product name, total amount, last date added}
When I click add item in the add item page how can I sync data between add item page and inventory page? (how to increment the total amount in the inventory page?) and will it be ACID? foe example when I click add item. the item is recorded in the add item page and while the incrementing is almost happening the electricity is fail and the result is there is a item in add item page but the increment is not happened because the electricity is off. which means this transaction is no longer atomic.
How to solve this problem?

Adding Quantity Change to Drop Down Menu

I am trying to make a pay now button for a registration form online. Each individual has two options for payment. If they are a member, they can pick and pay the member's rate for registering for this event. If they are not members, they will pick the public's rate option for it. That's fine. It works great and it will ask them to either pay the member rate or public rate.
My question is, I would like to add another drop down button which would allow them to change the quantity of tickets they buy to this event. So if they want to but 6 tickets, they select 6. And if they are not members, in the next drop down box, they select Public.
I can add the second drop down menu, but it doesn't affect pricing at all, doesn't change the quantity.
Any help?
If the price of each quantity is arbitrary, this can only be done with custom javascript.
Do your prices and quantities scale linearly? I.e. 1 for $10, 2 for $20, 3 for $30, 4 for $40 -- if so, you can use Add to Cart / Shopping Cart Buttons to handle the quantities.
Another potential hack is to multiply your current dropdown's number of entries with the number of your second menu.
General Public 1 ticket - $15
General PUblic 2 tickets - $25
Members Only 1 ticket - $10
Members Only 2 tickets - $20
Another way is to use 2 separate buttons, one listing the member rates and one listing the public rates. This might actually be the good-enough path of least resistance.

Resources