SQL mass updates on Volusion - sql

Right now I am trying to update a field for a lot of products using SQL on Volusion but I can't seem to get it right.
I am trying to update the Package Type to UPS Package for every product but when I update it this way, it just adds another option on the drop down list titled the exact same thing
https://i.imgur.com/MhPmRIJ.png
I imagine what I should be doing is changing things around so that instead of updating every product I'm making every product choose UPS Package from the existing menu? If I manually change a product to UPS Package (correctly) then export all product data the field is displayed as just a '2' on the spreadsheet, but I also can't just put a '2' in on the mass update.
Thanks in advance
1:

Its the space before the SET value that is causing this, which you would need in order to keep this on the same line (otherwise this becomes products_joinedSET). This was a correction made to any SQL that can be run in a store that was made back in mid November. So any queries with a SET value will need a line break in order to remove that space between the table name and the SET.
UPDATE Products_Joined
SET Package_Type = 'UPS Package' WHERE ProductPrice = '0'
Of course, if you want to change ALL your products to UPS Package and have products that are more than $0.00 then you'll need to remove WHERE ProductPrice = '0'

Related

How can you find the number of cells changed from an SQL UPDATE statement?

Say you have the following table:
If the image doesn't load, the table contains car names, their brand and whether they're in a sale
Now, let's say the car dealership decides to put all Skodas and Minis on sale, this SQL command can be used:
UPDATE cars SET InSale=True WHERE Brand in ("Skoda", "Mini")
Words in code are me trying to put ` around them
Which works. However, it would be useful to return how many cells changed value, so in this case 3, because the Rapid and Countryman were already in the sale, so they don't count
Is there any command I can run in/after the SQL above to return cells changed? The only idea I have is using some form of COUNT command, but I'm not sure how to implement such a thing
You can use SQL%ROWCOUNT to get the count of records updated by your UPDATE statement.
You may have to modify your UPDATE statement so that correct number is captured by SQL%ROWCOUNT.
UPDATE cars SET InSale=True WHERE Brand in ("Skoda", "Mini") and not InSale

SQL query to change text on export, but not in database

I was wondering if there is a way to write an SQL query that would change text upon export but not in the database.
For example:
I have a query that exports a .csv file with prices and quantities for selling products online. Then I manually change a few products prices to cover online fees and then upload the file. What I would like to accomplish is having this built into the query so I can have it update automatically but I do not want the price to be changed in my database.
Is this possible?
Thanks, and let me know if you'd like additional clarification.
You can manually modify the select without affecting the data in the database. For example, if ordering shoes adds a 15% online fee, you could do the following:
SELECT
CASE WHEN [ProductType] = 'Shoes' THEN Price * 1.15 ELSE Price END AS OnlinePrice
FROM
[dbo].[Product]
If that doesn't help, can you provide a more concrete example of what you're trying to achieve?

Prestashop - Product default combination doesn't want to save

I'm relatively new with working with Prestashop and I cannot fix one problem.
After deleting one combination for a product new default combination doesn't want to save and therefore the price showing on the website is not correct.
Any ideas how to fix it?
Thanks!
It might be possible that the combination that you have deleted is a default combination, you can try the following steps to set another default combination.
Open table ps_product_attribute and filter the rows with product ID of the product you want to edit. You will see a column default_on in this table, just edit it to 1 for the combination you want to set as default.
Experienced exactly the same problem (Prestashop 1.6.23) - the default product combination did not want to save.
In debug mode received an error stating the "default_on" field was already set for this product.
Solved it by opening the database table "ps_product_attribute" and searched via the product ID. Deleted the old combinations manually (which were not displayed at the back-end anymore and not in use). Then I was able to set the default combination again.
Sidenote: in our Prestashop setup (with a custom theme) the price was showing as 0 EUR (front-end) before getting the default combination to save again.

Database Design: Line Items & Additional Items

I am looking for a solution or to be told it simply is not possible/good practice.
I currently have a database whereby I can create new orders and select from a lookup table of products that I offer. This works great for the most part but i would also like to be able to add random miscellaneous items to the order. For instance one invoice may read "End of Tenancy Clean" and the listed product but then have also an entry for "2x Lightbulb" or something to that effect.
I have tried creating another lookup table for these items but the problem is i don't want to have to pre-define every conceivable item before I can make orders. I would much prefer to be able to simply type in the Item and price when it is needed.
Is there any database design or workaround that can achieve this? Any help is greatly appreciated. FYI I am using Lightswitch 2012 if that helps.
One option I've seen in the past is a record in your normal items table labeled something like "Additional Service", and the application code will recognize this item and also require you to enter or edit a description to print with the invoice.
In the ERP system which we have at work, there is a flag in the parts table which allows one to change the description of the part in orders; in other words, one lists the part number in the order and then changes the description. This one off description is stored in a special table (called NONSTANDARD) which basically has two fields - an id field and the description. There is a field in the 'orderlines' table which stores the id of the record in the special table. Normally the value of this field will be 0, which means that the normal description of the part be displayed, but if it's greater than 0, then the description is taken from the appropriate row in the nonstandard table.
You mean something like this?
(only key attributes included, for brevity)

Assign Tax Class to Products

I have (what I think is) a simple problem with my Magento tax classes. I have around 400 products in my shop and only 20 of them have a tax class assigned to it. I checked my database and the table "catalog_product_index_price" and all the products with the working tax have tax_class_id = 1 and all the not working ones have tax_class_id = 0.
So I thought I'll just update every product to tax_class_id = 1 and I'm done, but as soon as I re-indexed my prices in the Magento back-end the products got tax_class_id = 0 again.
Somewhere there must be a default, but I can't find it anywhere.
catalog_product_index_price is an index table, which is populated during reindexation process. It means that it pulls data from other tables and group them in this table for further use. That's why your changes were overridden after the reindex.
If you want to change tax_class_id for your products, the easiest option would be to use Mass Update* functionality in your admin panel. Open Manage Products section, select all products (select all), choose Update Attributes from action dropdown, and you'll be able to change Tax Class for all the products at once.
Try change it by hand by going to Catalog -> Manage Product -> Click on one -> Prices -> Tax Class.
Then have a look how it changes in the back end.
select * from catalog_product_index_price where entity_id = [[product_id]];
Best bet from here is to trace the SQL statement by changing pdo debug on by logging the sql statements: http://yauhen.yakimovich.info/blog/2011/03/21/log-all-sql-queries-in-magento/