Thanks.
v3.0.3.9 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.
Take a look at my extension:
Just Purchased Notifications And More (Real Time Notifications)
https://www.opencart.com/index.php?rout ... n_id=35052
Please check its live demo.
v3.0.3.9 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.
v3.0.3.9 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.
If your store contains only unique products (one of a kind) then it would be better to include the cart contents in the product availability instead of encouraging a rat-race to checkout.This to encourage someone to hurry up and buy, my store is made up of single inventory products
Currently the product availability is based on stock, not what is in anybodies cart.
That is somewhat strange as in a physical shop, once a customer puts a unique product in his basket nobody else can as it is off the shelf.
In OC many customers can put the same unique product in their cart as it is not taken off the shelf, whoever checks out first wins.
So basically, subtract the quantity of the product in anybodies cart from the stock quantity to obtain the availability.
Then when someone puts the product in their cart, it becomes unavailable for everybody else until that cart is discarded.
There is a problematic side-effect with this as OC retains the carts of registered customers indefinitely.
This would mean that when a registered customer puts the product in their cart, it becomes unavailable for everybody else until they remove it themselves.
Then again, retaining carts for registered customers indefinitely is a silly, confusing and unnecessary, that is what wish-lists are for.
That being said, Amazon work in exactly the same way - if there is only one product and several people have it in the cart - who ever pays first wins - just like OC Amazon keeps your cart although it works differently .. and the ONLY ONE LEFT IN STOCK is highlighted on the product page.
I believe that is sufficient in their case as there are not always only one item, so there is, having lost out once, an element of do I want it better buy it quick, I can always cancel .. so that is another thing you have to consider when making people rush to buy ..
Anyway, you could try something like this
Controller:
Code: Select all
$sql = "select SUM(quantity) as quantity from " . DB_PREFIX . "cart where session_id != '".$this->session->getId()."' and product_id = '".(int)$this->request->get['product_id']."'";
$query = $this->db->query($sql);
$data['product_cart_qty_others'] = (!empty($query->row['quantity']) ? $query->row['quantity'] : 0);
Code: Select all
{% if product_cart_qty_others %}
<li><h1>Someone else has put this product in their cart, RUN!</h1></li>
{% endif %}
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
If you can't find an extension, you could pay a developer such as ourselves or post a job in the Commercial Support Forum.
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
I love what you put in for the display lmao. I hear all you're saying, but I think your code is the path I'd like to take. I found where I wanted to put the display, but I can't find the file or where in the file to put the database query. I put the query at the top of: /catalog/controller/journal3/product.php, and I put the display in: /catalog/view/theme/journal3/template/product/product.twig. Where should I actually put the query?
Thanks.
v3.0.3.9 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.
You need to edit the 3 files associated with the page you want to display the query on (or make the files and link them), for this explanation I am using the product page.
So you'd edit:
/catalog/model/catalog/product.php (the database query page)
In this I created a function "getLiveStock" to query the database:
Code: Select all
public function getLiveStock() {
$sql = "select SUM(quantity) as quantity from " . DB_PREFIX . "cart where session_id != '".$this->session->getId()."' and product_id = '".(int)$this->request->get['product_id']."'";
$query = $this->db->query($sql);
$data['product_cart_qty_others'] = (!empty($query->row['quantity']) ? $query->row['quantity'] : 0);
return $data['product_cart_qty_others'];
}
/catalog/view/theme/journal3/template/product/product.twig (the display page)(the theme of your choice)
In this I checked if the function I created found what I want
Code: Select all
{% if product_cart_qty_others %}
Some text
{% endif %}
/catalog/controller/product/product.php (the control page)
In this I put the following to get the information that was queried. "model_catalog_product" being the file and path I believe of the file the function was put in.
Code: Select all
$data['product_cart_qty_others'] = $this->model_catalog_product->getLiveStock();
Code: Select all
$this->load->model('catalog/product');
Now when I have time I'll figure out how to make this into a module.
v3.0.3.9 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.
there is no
Code: Select all
public function getLiveStock() {
Code: Select all
{% if LiveStock %}
If you want assistance and you have that theme, you must ask them.
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
I'm sorry, I'm a little lost. For future reference, what does whatever theme I use have to do with a request like mine? What I wanted, did, and now need has nothing to do with a template and was put in the core files except for the display portion...still learning this. Is "Journal" a bad thing here? Do I have to hide their name (or any template name) even for things that don't concern the theme? What I would have expected was to get assistance based off base/fresh installation and then I figure out the rest based on my theme because as far as I can see my question has nothing to do with my theme, a bug, or code conflict. I don't think a wishlist query is based in Journal?
Thanks.
v3.0.3.9 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.
Users browsing this forum: Semrush [Bot] and 575 guests