473,698 Members | 2,434 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Shopping cart -fly to basket in asp.net and dhtml

10 New Member
hi all. now i m creating shopping cart. i would like to make when the user click the add to basket button, item added visually shown to user. i found one script for this in net.. but i couldnt pass dynamic productid to that addtobasket javascript function.
this is my function..
function addToBasket(productId)
{
if(!shopping_ca rt_div)shopping _cart_div = document.getEle mentById('shopp ing_cart');
if(!flyingDiv){
flyingDiv = document.create Element('DIV');
flyingDiv.style .position = 'absolute';
document.body.a ppendChild(flyi ngDiv);
}

shopping_cart_x = shoppingCart_ge tLeftPos(shoppi ng_cart_div);
shopping_cart_y = shoppingCart_ge tTopPos(shoppin g_cart_div);

currentProductD iv = document.getEle mentById('slidingProduct ' + productId);

currentXPos = shoppingCart_ge tLeftPos(curren tProductDiv);
currentYPos = shoppingCart_ge tTopPos(current ProductDiv);

diffX = shopping_cart_x - currentXPos;
diffY = shopping_cart_y - currentYPos;



var shoppingContent Copy = currentProductD iv.cloneNode(tr ue);
shoppingContent Copy.id='';
flyingDiv.inner HTML = '';
flyingDiv.style .left = currentXPos + 'px';
flyingDiv.style .top = currentYPos + 'px';
flyingDiv.appen dChild(shopping ContentCopy);
flyingDiv.style .display='block ';
flyingDiv.style .width = currentProductD iv.offsetWidth + 'px';
flyToBasket(pro ductId);

}
this is my asp.net code


<asp:DataList ID="dlstProduct Details" runat="server" RepeatDirection ="Horizontal " RepeatColumns=" 3" HorizontalAlign ="Center" style="text-align: center" Width="100%" SkinID="DataLis t" >
<ItemTemplate >
<div id="slidingProd uct+dynamicvalu e" class="sliding_ product"><asp:I mageButton ID="imgbtnProdu ctImage" runat="server" ImageUrl='<%#"i mages.aspx?id=" + Eval("ProductNo ")%>' Height="100" Width="100" Commandname='<% #DataBinder.Eva l(Container.Dat aItem, "ProductNo" )%>' OnCommand="Filt erdescription"/>
<br/>
<asp:Label ID="lblProductN ame" runat ="server" Text ='<%#DataBinder .Eval(Container .DataItem, "Productname")% >'></asp:Label>
<asp:Label ID="lblHyp" runat="server" text=" - " ForeColor="#ff8 000"/>
<asp:Label ID="lblModelNo " runat ="server" Text ='<%#DataBinder .Eval(Container .DataItem, "ModelNo")% >'></asp:Label>
<br />
<asp:Label ID="lblrs" runat="server" text="RS." ForeColor="#ff8 000"/>
<asp:Label ID="lblPrice" runat="server" Text='<%#DataBi nder.Eval(Conta iner.DataItem, "SalesPrice")%> ' ForeColor="#ff8 000" ></asp:Label>
<asp:Label ID="Label1" runat ="server" Text ='<%#DataBinder .Eval(Container .DataItem, "ProductNo")%>' ></asp:Label>

<br />
<a href="#" onclick="addToBasket(pro ductno);return false;"><img src="images/basket.gif"></a>

</div>
</ItemTemplate>
</asp:DataList>

just see those functions. i need to pass dynamic value to addtobasket method and div id.
any one have any idea... pls modify this code for my requirement... thanks...
Dec 17 '07 #1
0 1802

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2857
by: Don Grover | last post by:
I am retrieving costs and product id's from a sql db. and need to build a shopping cart around it. How do I store the selected items and qty req so I can move into another catalog and total up as im going. Just a couple of hints will do, Im familiar with vb script but not java based code , and im wondering how to store what they select so I can move around different product ranges. Don
1
3574
by: madison | last post by:
Hi, I am trying to start a website using paypals shopping cart function. If i have 10 items and they sell out, how do I make it so the item is then listed as sold out. The next person would not be able to come along and add it to their shopping cart. thanks joy
1
1812
by: Jia Sun | last post by:
hello , everybody , i need a similar program , just like fancyimport.com if possible, pls contact me ,thank you very much . inchina@gmail.com
1
3217
by: Adil Akram | last post by:
I have created a site shopping cart in ASP.net. I am using ASP session object's SessionID on non SSL connection to track session. While adding products to cart DB I insert product and SessionID in table. All products and cart status pages are on non SSL connection. On checkout to get secure user information I shifted connection to SSL but when shifting to SSL, the SessionID changed (As is this is default behavior of IIS to prevent...
2
2298
by: G.E.M.P | last post by:
High Level Session Handling Design for a Shopping cart 0) What am I missing? 1) How does OSCommerce do it? I'm thinking about building a shopping cart from scratch, using a library of dynamic screen generation routines (already written) that take an XML stream as input from various "search for products" forms. That way I can run queries in one window and display the dynamic results in another. The searching functions will probably
7
2630
by: isaac2004 | last post by:
hi i have a basic asp page that acts as an online bookstore. on my cart page i am having trouble generating 3 numbers; a subtotal, a shipping total, and a final price. here is my code i would like it to work properly so that a record count counts through all the books and genertates these numbers. watch out for line breaks <%@ Language=VBScript %> <% Option Explicit %> <!--#include file="DatabaseConnect.asp"-->
1
7293
by: jecha | last post by:
I'm implementing a shopping cart but am having a problem in checking out a person who has added item in his/her shopping busket.The code for the checkout.php script is given below <? require_once('functions.inc.php'); session_start(); do_html_header("Checkout"); $cart = $_SESSION; if($cart&&array_count_values($cart)) { display_cart($cart,false,0); display_checkout_form($HTTP_POST_VARS);
15
4289
gregerly
by: gregerly | last post by:
Hello, I once again turn to this community of genius' for some help with a problem. I've got a shopping cart (which is working well so far) that I will be implementing all kinds of AJAX functionality on. However, first I want to make sure it works if javascript is not available. So when your on the shopping cart page, you can update the quantities then click Update Cart, which would update the totals, and refresh the shopping cart page,...
3
2890
by: Paulo | last post by:
Hi, beginner on asp.net 2.0 C# VS 2005, how can I use the shopping cart concept on my application? When the user clicks add item, it will be stored on some storage format, I dont know what is the term: temp/global DataSet, etc... and it should be read on other web-form to checkout the items... Can you point me to the right direction? Thank you very much!
6
1873
by: frank | last post by:
can anyone point me to a free shopping-cart script?
0
8604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9160
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9029
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8897
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8862
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6521
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.