I am working on a Opencart project and it is for Australia customers. So I have to set GST 10% to all items. The items are already added to the cart and I figured a way to add tax classes and I added it to a product and it works good.
The problem is the catalog has more than 10000 products already and I need to update tax classes to all the products. I knew we can run a query to do that but my question is "Is there a way to set a tax class to default" Please let me know. Thanks
My Opencart version is 1.5.1.3
The easiest way to do this would be to use SQL. You will need to run the following code in your phpMyAdmin or whatever other tool you use for SQL on your server
UPDATE `product` SET `tax_class_id` = '123';
changing 123 to the tax class ID. You may also need to add a database prefix to the table name product depending on your setup
EDIT
To get this to work with new products by default, open /admin/controller/catalog/product.php and change this line
$this->data['tax_class_id'] = 0;
setting the 0 to the tax class ID
I tried this on my setup (1.5.3.1) and it seemed to work ok; Assuming that all those products you have entered are set to the same existing Tax Class? If that's the case, then you can edit that Tax Class that the majority of products are on, and then change the Tax Rate for that class to a GST Tax Rate you create. You should also be able to rename that Tax Class so it appears as GST on the actual website. I hope that helps.
Related
In mine Prestdashop 1.6.1.9 I set up the POS and the e-commerce for selling in our shop and online.
In the last few days I saw an error inside the shop:
The real quantity is lower then the physical
the physical is negative in some product
if someone buy a 0 product, sometimes it can go in negative status
I have tried all the solutions of the prestashop forum and I've blocked the negative sell in any position however without success.
There's a chance to reset some quantity via Database or a code for prevent prestashop to go in negative?
Thank you so much!
I think you can create a mysql trigger when the stocks is update/insert
example:
CREATE TRIGGER ins_transaction BEFORE INSERT ON account
FOR EACH ROW PRECEDES ins_sum
SET
#deposits = #deposits + IF(NEW.amount>0,NEW.amount,0),
#withdrawals = #withdrawals + IF(NEW.amount<0,-NEW.amount,0);
You can add some similar and if the quantity is less 0, update the row.
https://dev.mysql.com/doc/refman/5.7/en/trigger-syntax.html
-EDIT-
Also you can try to change the functions updateQuantity() and setQuantity() in the class StockAvailable
try add some like:
if($delta_quantity<0)
$delta_quantity=0;
hope it help you
From the question I think the problem is negative quantity.
There is two places in prestashop's backoffice that you can set this behavior:
General for all products: Preferences -> Products ("Products Stock" section)
Product Specific: Catalog -> Products (Choose a product) ("Quantities" section)
In addition to setting the right choice in General settings, you should check for each product in its specific settings to see if it has overridden the general settings.
There is another way to have get the perfect one.
I got this error from the ORDER STATUS bar and the Cancelled Order.
When you cancel and order, this one still have product inside. You must remove all the product from the order then cancel it.
Another way it's on the order status:
You need to sign it as Shipped and and Validate!
Hope this can help :D
Is it possible to add second price to each product and use that price if user in specific usergroup?
I was thinking doing that by adding another column to the product price table and then take advantage of the promotion function to somehow use that price instead of the usual discount you can set from admin.
Any pointers or ideas would be great, thank you.
Yes, it is possible to define price for product that is valid/shown only for users in specific usergroup.
To achieve this you need to use Quantity discounts tab on Editing product page.
Name of this tab implies as there must be some large amount of items bought (like volume discounts...), but quantity can also be just 1 item.
For this you first need to define usergroup (Customers->User groups).
Example is shown also on CS-Cart Knowledge base: Wholesale Prices
Best regards,
Bostjan
It is default CS-Cart feature. Please check the following article in the database:
http://kb.cs-cart.com/wholesale-prices
I trying to allow users to get the first product sample they add to their cart for free, but any samples they add after (including the one they already added) should be normal price. Right now I using setOriginalCustomPrice in a module, but the customer can change the quantity, and the price stays at zero instead of going up. Anyone know how to go about this?
You can achieve this by a simple calculation where you are using setOriginalCustomPrice.Currently I think you are setting price 0.Instead of doing this,use following logic to set custom price.
$customPrice=$qtyincart*$productPrice-$productPrice.
So if user add 1 qty then $customPrice will be 0 else will equal to sum of qty-1.
I hope this solve your purpose.
hey i'm implementing a custom discount system since magento discount system does not feet my requirements so i'm trying to apply a discount on an Mage_Sales_Model_Quote_Item I've read some and I've found the following function setOriginalCustomPrice the thing is that it applies on the item, and if the user changes the quantity he will get the discount on the item with the new quantity, so i'm trying to use a different method addOption on the item and only on the cart page show the calculations based on the quantity in the option value
$item->addOption(array('code'=>'promo','value' => serialize(['amount'=>10,'qty'=>1])));
and in the cart page
$promo = $item->getOptionByCode('promo');
echo '<div class="orig-price">'.$item->getOriginalPrice().'</div>';
echo '<div class="new-price">'.$item->getOriginalPrice() - ($promo['amount'] * $promo['qty']).'</div>';
the problem is that it does'nt actually apply the new price on the product,
so i want to customize Mage_Sales_Model_Quote->collectTotals() to show my discounts
and send it to the admin back-end when order is completed
how can i achieve that?
thanks in advance
I think there is a fundamental flaw in your approach. I'm not sure what you don't like in standard discounts, and what you can't achieve with catalog or shopping cart rules, but what you're trying to do definitely breaks these features (along with my heart).
However, if you're sure about what you're trying to do, then don't customize Mage_Sales_Model_Quote->collectTotals().
This function just... well, it collects all totals: subtotal, shipping, discount, etc. And it looks like you're changing only price output, but Magento itself doesn't know anything about it.
So if you want to let Magento know that you're changing the item price, you have to either add your own total, or change one of the existing totals. After that Magento will do everything else. Since after your changes Magento outputs already calculated price instead of original one, it may be strange for customer to see the original price in the cart and the additional discount total. So it looks like you will have to change subtotal total.
To do that you have to rewrite Mage_Sales_Model_Quote_Address_Total_Subtotal class in your extension and insert your calculation in _initItem() method. Around line 111 in the original file you will see the code:
$item->setPrice($finalPrice)
->setBaseOriginalPrice($finalPrice);
And this is where Magento sets price for the item, so you can insert your calculations and change $finalPrice before that. If you have virtual products, you will have to change collect() method too.
I have an OpenCart installation that is running two stores, one wholesale and one retail. The product catalog is shared, but the problem is that OpenCart doesn't natively support multiple pricing options. So I added a new field to the oc_product table, retail_price. The idea is that I would use the price field for wholesale pricing and the retail_price field for -- you guessed it -- retail pricing.
I have everything pretty much covered on the admin side, so my new field is showing in the product section and is being updated in the database.
Now the issue is getting the price to change on the front end for the retail store. Needless to say, product price is used in a ton of different scripts. So I figured the best/sneakiest method would be to change the price field when the database is queried and the price data is initially set. This is kind of where I got lost... I changed it in some places I thought were right but the price doesn't change on the front end. Sometimes OpenCart can be a mysterious fig.
Can anyone give me a clue as to where the best place(s) to change the price would be?
I assume that you've already created a different customer type for both wholesale and retail customers in the admin area.
That being the case, it's very simple to add this functionality to the model.
Open:
catalog/model/catalog/products.php
On or around line 22 you should see a line that looks like this:
$query->row['price'] = ($query->row['discount'] ?
$query->row['discount'] : $query->row['price']);
Determine the numerical value of your retail customer, let's assume it's 1 and wholesale customers is 2.
The variable $customer_group_id used below is previously set at the open of the getProduct() method.
Replace the previous line with the following:
if ($customer_group_id == 2):
$query->row['price'] = ($query->row['discount'] ?
$query->row['discount'] : $query->row['price']);
else:
$query->row['price'] = ($query->row['discount'] ?
$query->row['discount'] : $query->row['retail_price']);
endif;
Now if your customer is logged in and is not a wholesale customer, or is not logged in, they will see the retail price, if they are logged in as a wholesale customer they will see the wholesale price.