Magento MySQL database stock update - mysql

I need some help updating all configurable products from
Manage Stock = no
and
Stock Availability = no
to
Manage Stock = yes
and
Stock Availability = yes
via the database...
the stock for the products I believe is in the table
cataloginventory_stock_item
however I can't see where the product type = configurable is defined in this table, which causes a bit of an issue as I can't see which to update...
Any thoughts would be very appreciated
Regards
Henry

if you only update the configurable product quantity,best solution is Go to admin>system>Import/Export>Dataflow - Profiles>Export Product Stocks
Then select only Mapped Fields in Data Format and add these required fields (screen shot below) in Field Mapping section and save and continue,
Then go to Run Profile section in your left hand side and click on Run Profile button.
Connect FTP or download your csv root/var/export/export_product_stocks.csv update product inventory or import Import/Export>Dataflow - Profiles>import Product Stocks
upload your file and same run profile.
your all product's inventory will be updated.
Thanks......

Related

How to avoid end user actions based on stale data in DB

I have a database table at the backend, that provides various items for sale and their prices as well. For the sake of simplicity, let us assume that the schema for the same is like so:-
class Product(models.Model):
item_id = models.Integer()
item_name = models.CharField(max_length=30)
item_price = models.CharField(max_length=30)
item_count = models.Integer()
There is an API getProducts(), that is used to show to the enduser all the products available, including their price.
There is another API buyProduct(product_id), exposed to the enduser, using which he may purchase the item after seeing its price. There is a third API, updatePrice(product_id, new_price) available to the administration backend using which the price may be modified.
Now w/o having a database transaction that spans across >1 HTTP requests, how can I ensure that the API buyProduct() succeeds only if the price is the same as what the enduser saw (basically whatever getProducts() had returned last to the browser). It is possible that a customer sees the price of a product as 1$, and clicks BUY, but simultaneously the price at the backend was changed to 2$.
I have two solutions:-
Fix the buyProduct() API to include a price, which indicates
whichever price that was shown to the enduser. If the product price
has changed, throw an error.
Include a GUID against the products which represents the version of
the product row. This is then carried all the way to the enduser's
browser(but not shown to the user), and quoted in the buyProduct()
also. Anytime there is a modification to any row in the Products
table, the GUID will get updated. buyProduct() will ensure that at
the time the API is executed, the product's GUID should be what the
API carried.
I believe <2> is the way to go, since even the item_count is prone to change. But is this how everyone does things? Is there a django pattern to solve this?
Just realised that the E-Tag header and the Cache-Control headers in HTTP seem to be a recommended way to avoid data corruption. But do folks really follow this way? I found a link about this here

How to change the stock reservation in Magento from pending to processing?

How can I prevent Magento from reserving product stock on "pending" orders. Generally allow stock quantity reservation for paid orders only.
Thanks a lot!
This can't be done without code changes.
In Order to generally prevent Magento from subtracting stock quantity from products you may use system configuration field "Decrease Stock When Order is Placed" set to "no" under System Config->Catalog->Inventory
To achieve desired behaviour you may try following Solution:
Disable default magento behaviour by setting "Decrease Stock..." to
"no"
Create new local Module
Add Observer for event sales_order_save_after
Compare status values and decrease stock when needed

When creating private products in bugzilla do I need to have user groups instead of system groups?

I am trying to create a product in bugzilla that would allow our client access to ONLY that product and not everything else. I created a user group but it seems everyone in the office (whether part of that group or not) can see the new product.
I think the issue is that we are very small and never needed user groups before so all of us are in the various system groups. Do I need to go through and first, create new groups based on the system groups and then utilize these new user groups on each of our current products?
The system groups do not have the "use for bugs" checkbox so I have not been able to even see the Edit Group table for any of them.
Thx

How to customise Magento CSV file in order to match my suppliers CSV products catalog

How to import a CSV product catalog from my supplier(s) using Magento Community Version: 1.7.0.2?
I have 2 suppliers:
The first with 200 products, that I have inserted manually.
The second one (is a new supplier) with over 1000 products.
I have just received a CSV file with all the products from that supplier.
I would like this time to make full use of Magento import function in order to save a lot of time. But I don't know how to proceed.
My first issue is that the CSV file from my new supplier have the following attributes:
products_id, products_master, products_model, products_ean_code, products_name, products_description, products_image, products_image_extra1, products_image_extra2, products_image_extra3, products_image_extra4, products_image_extra5, products_image_extra6, products_quantity, products_price, products_manufacturer, products_status
While my Magento store have these attributes:
sku,_store,_attribute_set,_type,_category,_root_category,_product_websites,activation_information,color,colors,computer_manufacturers,contrast_ratio,cost,country_of_manufacture,country_orgin,cpu_speed,created_at,custom_design,custom_design_from,custom_design_to,custom_layout_update,description,dimension,enable_googlecheckout,farge,featured,finish,gallery,gender,gift_message_available,harddrive_speed,hardrive,has_options,image,image_label,in_depth,manufacturer,max_resolution,media_gallery,megapixels,memory,meta_description,meta_keyword,meta_title,minimal_price,model,msrp,msrp_display_actual_price_type,msrp_enabled,name,navn_eller_initialer,news_from_date,news_to_date,options_container,page_layout,personalisering,price,processor,ram_size,required_options,response_time,room,screensize,shape,shirt_size,shoe_size,shoe_type,short_description,sko_size,sko_size_m,small_image,small_image_label,special_from_date,special_price,special_to_date,status,tax_class_id,thumbnail,thumbnail_label,updated_at,url_key,url_path,visibility,weight,qty,min_qty,use_config_min_qty,is_qty_decimal,backorders,use_config_backorders,min_sale_qty,use_config_min_sale_qty,max_sale_qty,use_config_max_sale_qty,is_in_stock,notify_stock_qty,use_config_notify_stock_qty,manage_stock,use_config_manage_stock,stock_status_changed_auto,use_config_qty_increments,qty_increments,use_config_enable_qty_inc,enable_qty_increments,is_decimal_divided,_links_related_sku,_links_related_position,_links_crosssell_sku,_links_crosssell_position,_links_upsell_sku,_links_upsell_position,_associated_sku,_associated_default_qty,_associated_position,_tier_price_website,_tier_price_customer_group,_tier_price_qty,_tier_price_price,_group_price_website,_group_price_customer_group,_group_price_price,_media_attribute_id,_media_image,_media_lable,_media_position,_media_is_disabled,_super_products_sku,_super_attribute_code,_super_attribute_option,_super_attribute_price_corr
How should I proceed step by step to make Magento accept the CSV file from my supplier?
I need a solution as simple and as specific as possible because I am new at Magento and even if I have built my store all by myself, I am not a programmer.
What you're looking to do isn't hugely difficult, but careful work needs to be considered. I'm only going to talk about simple products and not other product types, or extra attributes based on the assumption that you don't need those.
What you need to do is to "map" your supplier's attributes to magento's attributes. Some of them should be very easy to see: "products_name" from your supplier will be "name" in the magento table.
What I'd recommend you do is to create a dummy product using the manage products page first, fill in all the details with the supplier's table's title instead of the data - so for instance products_name for Name. Fill in all other necessary information as well, and choosing the appropriate options for the product.
Note that some of them may not be relevant at all and you can leave them out. Leave out the images as well, we'll deal with that another time.
Once you've done that, use System > Import/Export > Export to export a .csv file - you now have a .csv file for mapping purposes, where the relevant supplier's titles match up against your magneto table. Using that, copy and paste your data over from your supplier's file. Rinse and repeat for different suppliers.
Important Note: products_id from your supplier may not make a good sku, since different suppliers may actually use the same code for their own products (we have two suppliers that use 5 digit numbers), so you should create your own sku accordingly using excel formulas or something.
Import this file now and you should have all the products setup, sans images.
I'll come back to images tomorrow but it's unfortunately seriously complicated due to various shortfalls in magento's data profile when handling .csv files. Here's a link to give you an idea:
http://ashsmith.co/2012/05/importing-product-images-via-csv-in-magento-1-7-0-0/

How to modify the values in one database based on changes in the other database?

I'm running a gaming server and a gaming forum. Each have their own databases. The game server has a database that tracks all players and their store credits (for in-game cosmetic items). Then the forum database that tracks users, posts and so on.
My goal here is to reward players that post on the forum, by awarding them in-game currency after every forum post they submit. I am trying to improve forum participation with this method.
How can I make it so that every time a user posts, it would tell the gaming server's database to add a set amount of in-game currency to their attached account?
The forum tracks users by their registration ID. The game server tracks users by their account ID.
Thanks for all the help!
I assume you don't have access or don't wish to add code to your forum installation in order to achieve this, the solution then could be to use triggers for MySQL. You'll need to replace with correct table names etc. as you didn't post your database table-structure.
CREATE TRIGGER `CreditsSync` AFTER UPDATE ON `F`.Posts
FOR EACH ROW BEGIN
UPDATE `U`.Users, `F`.Posts SET `U`.Users.credits = `F`.Posts.num WHERE `F`.Posts.userid = `U`.Users.id
END
Triggers require MySQL 5.5 or higher, see https://dev.mysql.com/doc/refman/5.5/en/triggers.html for more information.
EDIT - Noticed that you wanted to insert into different tables in different databases, in the above SQL F = forum database, and U = user database - you'll need to replace this with the correct targeting for your dbs and tables.