But I would really appreciate your help on this one here...
I am playing arround with uCommerce razor store, and I am trying to build up template by myself here... now I am in the cart, and I am trying to find a way how to change ammount of products currently in the cart (basically change ammount of order line)...
Razor store makes some kind of Ajax call, I was woundering if I could do the same? Could someone please explain what is actually happening (or in this case must happen) in order to change order line ammount?
Sorry for raising the issue again, but now I have another question,
I have an iteration script that runs through all orderlines and shows products ammount in a input field...
But I have still the same issue,
@foreach (var lineItem in basket.OrderLines)
{
var product = @CatalogLibrary.GetProduct(lineItem.Sku);
var itemPrice = new Money(lineItem.Price, currency);
var itemTax = new Money(lineItem.VAT, currency);
var lineTotal = new Money(lineItem.Total.Value, currency);
<tr class="order-line">
<td><a href="@CatalogLibrary.GetNiceUrlForProduct(product)">@lineItem.ProductName</a> </td>
<td class="money">
@if (lineItem.UnitDiscount.HasValue && lineItem.UnitDiscount > 0)
{
var nowPrice = new Money((lineItem.Price - lineItem.UnitDiscount.Value), currency);
<span style="text-decoration: line-through">
@itemPrice
</span>
@nowPrice
}
else
{
@itemPrice
}
</td>
<td class="money">
@itemTax
</td>
<td>
<input type="text" id="[email protected]" name="[email protected]" data-orderlineid="@lineItem.OrderLineId" value="@lineItem.Quantity" class="qty" />
</td>
<td class="money line-total">
@lineTotal
</td>
<td>
<button type="submit" class="line-remove" name="basket-remove-item" value="@lineItem.OrderLineId">×</button></td>
</tr>
}
So my question again is what do I need to do in order to set new product ammount in the textbox after I make post, or change the value and simply hit enter?
Any ideas how to do that?
This is from uCommerce standard razor shop by the way...
Getting a bit confused here, cause can't actually use your code snippet in this layout...
I haven't taken the time to take a closer look at the uCommerce standard razor shop yet, so i dont know if there is a built in way to update the cart content.
However:
I would hookup a jquery event to the value in the textbox (quantity), so when it changes it calls the webservice who then updates the quantity based on the new value, and get the orderlineid from data-orderlineid attribute.
The last part is reloading the cart content, or the old fashion way - reload the page.
Do you need some code snippets (and for what part of it)?
Well I really appreciated your help :-) and I will try doing the thing you are suggesting here,
but I think if you have a snippet that could help me here, And if it will not give you too much headache
It would be really helpfull to have an additional code snippet :-) Not just for me but also if someone else is surfing arround for same problem solution...
I actually did find a work arround, I used some of the scripts that are included along with Razorstore.
In my case, I missed <umbraco:macro runat="server" alias="ucActionsCart" /> macro.
Was a bit confused, not sure why didn't I included it earlyer :-)
But now I got it working (not 100% in the way I wanted it) but I will make it work exactly as I need it.
If you still have a suggestion to the approach you suggested in your previous post, I would love to hear what could go wrong or what other conditions must be met in order for your solution to work, cause I really like that Ajax post you suggested to use :-)
Product add to cart question
Hi guys,
Sorry for yet another noobie question...
But I would really appreciate your help on this one here...
I am playing arround with uCommerce razor store, and I am trying to build up template by myself here... now I am in the cart, and I am trying to find a way how to change ammount of products currently in the cart (basically change ammount of order line)...
Razor store makes some kind of Ajax call, I was woundering if I could do the same? Could someone please explain what is actually happening (or in this case must happen) in order to change order line ammount?
Much appreciated for help! :-)
//Dmitrij
Hi Dmitrij
What you want to do is call a webservice with the orderline Id of the orderline you want to change, and the new quantity.
The webservice will then use this method:
To change the quantity of that line.
I hope this helps.
Hej Nicolaj,
That's exactly what I needed :-)
Thanks again ;-)
//Dmitrij
Hej Nicolaj,
Sorry for raising the issue again, but now I have another question,
I have an iteration script that runs through all orderlines and shows products ammount in a input field...
But I have still the same issue,
So my question again is what do I need to do in order to set new product ammount in the textbox after I make post, or change the value and simply hit enter?
Any ideas how to do that?
This is from uCommerce standard razor shop by the way...
Getting a bit confused here, cause can't actually use your code snippet in this layout...
//Dmitrij
I haven't taken the time to take a closer look at the uCommerce standard razor shop yet, so i dont know if there is a built in way to update the cart content.
However:
I would hookup a jquery event to the value in the textbox (quantity), so when it changes it calls the webservice who then updates the quantity based on the new value, and get the orderlineid from data-orderlineid attribute.
The last part is reloading the cart content, or the old fashion way - reload the page.
Do you need some code snippets (and for what part of it)?
Hej Nicolaj,
Well I really appreciated your help :-) and I will try doing the thing you are suggesting here,
but I think if you have a snippet that could help me here, And if it will not give you too much headache
It would be really helpfull to have an additional code snippet :-) Not just for me but also if someone else is surfing arround for same problem solution...
Thanks alot for help :-)
Dmitrij
I couldn't find a simple example, but i wrote a quick demo (there might be some minor error but I hope you can get some inspiration).
The input field would look something like this:
Ahh.. that's ok,
I will try work something out from here, and will let you know if there will be any other issues,
Thanks for so far :-)
Hej Nickolaj,
Thanks for the last time :-)
Just have a short question,
Apperently I am getting an error here,
Javascript console says:
POST http://[mywebshop].dk/webshop/ChangeOrderLineQuantity/10/180 404 (Not Found)
send jquery.min.js:2 p.extend.ajax jquery.min.js:2 (anonymous function) cart.aspx:359 p.event.dispatch jquery.min.js:2 g.handle.h jquery.min.js:2
I am using (in my JS code) exact Ajax post you provided here as an example.
Any suggestions? :-)
Have you added the /webshop/ path to UmbracoReservedUrls?
Hej Nickolaj,
No, I actually haven't.
Could you tell me where it is located and what I need to add? :-)
Thanks again,
Dmitrij
Hi Dmitrij :)
In the webconfig:
The keys value contains URLs that is restricted from umbraco's URL engine.
You will have to add
To the list (use "," as a seperator)
Hej Nickolaj,
Sorry for bothering again :) Was hoping to hit the "home run" but yet got the same 404 again :-/
I checked Web.Config in the project root, and under <appSettings> found "umbracoReservedUrls" key.
It already had some reserverd paths from umbraco
I carefully added into the end
But still getting http-404 :( I am sure there are no blank spaces, or anything of that sort that could cause error in web.config key.
Any other suggestions what else can be wrong? :-(
Hej Nickolaj :)
I actually did find a work arround, I used some of the scripts that are included along with Razorstore.
In my case, I missed <umbraco:macro runat="server" alias="ucActionsCart" /> macro.
Was a bit confused, not sure why didn't I included it earlyer :-)
But now I got it working (not 100% in the way I wanted it) but I will make it work exactly as I need it.
If you still have a suggestion to the approach you suggested in your previous post, I would love to hear what could go wrong or what other conditions must be met in order for your solution to work, cause I really like that Ajax post you suggested to use :-)
Thanks so far, and have a great day!
Kind regards,
Dmitrij
Is it the webservice you have problem getting to work, in that case, what type of webservice are you making?
If you post a description with some code, i could take a look at your current solution and make some improvement idears (if any needed).
is working on a reply...