All Questions
Tagged with shopping-cart arrays
79
questions
0
votes
1
answer
5k
views
Uncaught TypeError: Cannot read properties of null (reading 'length') - JavaScript
I'm making a functional shopping cart website for a school project website using javascript, i use addtoCart() function to get product data from the product page, and a showCart() function to display ...
1
vote
1
answer
657
views
Trying to create a cart for shopping app however each element when trying to add them to an array is added to individual arrays?
I am working on a project to make a pizza app, however I've been stuck trying to get the add to cart function to work. I've got a file for managing adding items that are meant to be in the cart
import ...
0
votes
1
answer
472
views
PHP shopping cart array, get cart from session, group by category and count
I'm building a shopping cart using a free script I found. I am trying to count the items in each category to determine shipping charges. Categories are numeric in the database 1,2,3, etc. The script ...
-1
votes
1
answer
8k
views
How can I calculate the total price of products in a cart using JavaScript?
I'm stuck on how to calculate the total amount and total price of my cart in this project.
The task is to create a simple (beginners) e-commerce website where a customer should be able to click on a ...
1
vote
1
answer
46
views
Cart array $_SESSION['cart'] not prininting cart items properly
I am doing shopping cart functionality on an ecommerce site via $_SESSION.
I added cart items successfully on every click in $_SESSION['cart'] array. but unable to print it correctly.
I made an ...
0
votes
1
answer
862
views
How to check if an item exist in a dynamic array?
I want to add Items to cartArray. If Array has already an item , I m going to write a function which prevents it adding it again by just increasing its quantity.. How can it be possible. Array Item ...
0
votes
1
answer
83
views
List localStorage data
I have a question to save data with localStorage, it would be a shopping cart, it's getting now I need to list the data taken on the other page, I can list it through console.log, but I can't call the ...
-1
votes
1
answer
651
views
Add item to cart if size property is different but the ID keys are the same
I created a cart push insert items into it, the logic is this:
I have an array:
`let cartItems = [];`
To contain Product objects with defined properties:
{
"id": 10,
"name": "...
0
votes
1
answer
213
views
How to unset a laravel session array
Hi I'm trying to remove a product array inside my cart session when the quantity is 1 and user tries to remove it, simply unsets that.
Here is my code:
public function remove($id)
{
if (session('...
0
votes
1
answer
17
views
Can not understanding PHP associative array code difference in below codes
I have this code in my Shopping Cart. I got this from a site. I am using this and code is working fine but i can not understand the difference between the first code and the second code. It seems both ...
0
votes
1
answer
659
views
Array with objects, increasing/decreasing one of the value in object after click on button
I'm really rookie. I'm working on implementation of shopping cart and I'm stuck on one of the functionality.
After getting products to my cart (from local storage) I would like to manipulate the ...
1
vote
0
answers
38
views
Problem with deleting item out of cart when the same item with diffrent size is in cart already
Problem with removing items out of cart.
When pressing the generated delete button under the item the first item wil be removed out of the cart but then the other item with diffrent size but same ...
0
votes
0
answers
207
views
How to remove items from an array on a checkout page
New to JS and trying to create a simple shopping cart using only vanilla JS. I have an item with details and an image that populates on a shopping cart page. I need to have a delete button that allows ...
0
votes
1
answer
510
views
while making a shopping cart in javascript i am stuck with a function already in cart?
var products = [
["Product1", 1, "100", "1"],
["Prodict2", 1, "99", "2"],
["Product3", 1, "60", "3"],
["Product4", 1, "50", "4"],
];
function displayProducts() {
//alert('page');
var ...
1
vote
2
answers
519
views
How to get "individual cart items from a column" in the database using Gloudemans Shopping Cart
I am using Gloudemans Shopping Cart package and trying to get "individual cart items from a cart column" in the database, like 'name, price, qty', but for some reasons when I do:
{{ $order['...