How to show my own products only Magento - magento

I had set up a "Store Owner" role in Magento. Users with that role will be able to add/edit/delete products only.
What I need is some one to tell me how can I limit these users to see only their products in the list when they go to Catalog -> Manage Products ?
I want to achieve this with code editing if possible.
Also note that all users are using the same store.
Thanks

This is not an "out of the box" feature in Magento Community Edition (or Enterprise), so you'll need to write some code to make this work.
In general terms you'll want to:
Add a (hidden?) attribute to the product to store the User Id of the product "owner".
Write an event observer for catalog_product_save_before which assigns the current user's User Id field to the new product owner attribute.
Rewrite the _prepareCollection or _addColumnFilterToCollection methods of Mage_Adminhtml_Block_Catalog_Product_Grid to add the product_owner attribute to the collection and filter it to just the current user.
That will ensure that the only products that appear in the grid for a given user are the products they own. However, I would also implement an observer on the controller_action_predispatch_adminhtml_catalog_product_edit and controller_action_predispatch_adminhtml_catalog_product_save events to check the product owner value on products before they're edited/saved to make sure the user hasn't tried to edit a product that doesn't appear on the grid.
If you need any further assistance with adding attributes, setting up block rewrites, or creating event observers, I'm sure those questions have already been answered on SO, this question is a bit too broad to answer at that level of detail.

Related

Magento product visibility per customer

I'm looking for a solution to make products visibile/invisible per customer. There are some extension to limit the visibility of products per customer group, but I cant find a solution to set the visibility per customer.
Does anyone know a solution for this?
One way is integrating the extension as mentioned in the question itself.
A work-around would be to add a custom product attribute and we can add a code to check the logged-in customer group in the
app/design/frontend/package/theme/template/catalog/product/list.phtml
using
Mage::getSingleton('customer/session')->getCustomerGroupId();
and load the product collection which would filter out the products on the basis of the custom attributes using
$collection->addAttributeToFilter();
In my opinion this would be the easiest way to do this.

How to remove information in Magento catalog, but only for specific product type

I am wondering how can I delete this two divs -
in Magento catalog, but only for specific product type. In short, I would like to have product type which would appear in catalog only with product-image and product-name, without - price, Out of stock, Add to Wishlist, Add to Compare.
It's possible to load different layout updates depending on loaded product type. You can see an example of how it's done in Magento for configurable products here: https://github.com/LokeyCoding/magento-mirror/blob/magento-1.7/app/design/frontend/base/default/layout/catalog.xml#L275-L287
It's possible because view action of product controller makes this to be executed: https://github.com/LokeyCoding/magento-mirror/blob/magento-1.7/app/code/core/Mage/Catalog/Helper/Product/View.php#L59-L60
You can change the design for any product from the admin.
You need to create a separate theme with a different product page which will have only the attributes you would like.
Then you can select the design for that specific product. Please see the screenshot, how you can change design for any product

Only allow administrator to buy products in Magento frontend

I need to somehow setup a Magento store to disable purchasing of a few products, and instead show a message that they can only be bought in the physical store. The twist is that the store owner/administrator has to be able to "buy" these products on the frontend on behalf of the customer -- all payment options are not available in the backend.
So, is there a way to only allow certain customers/users to purchase certain products, and show all other customers and anonymous visitors a "not for sale" notice? (Not "out of stock".)
I have thought of creating a special store view or custom design, or even using some Javascript trickery to prevent unauthorized visitors to purchase these products. Any clever ideas?
1 - Creating a custom product attribute that identify these products
2 - Put owner/administrator in a special customer group
3 - Anywhere you have a 'add to cart' button, you check the above logic and only should 'add to cart' for those product if customer is in that owner/administrator customer group
You could try overwriting the addAction method within the CartController (app/code/core/Mage/Checkout/controllers/CartController.php), and create a conditional statement that checks the user level.
Look forward creating Custom Shopping Cart Pricerule.
By default they do not satisfy your needs.
But this is the best place for your logic!

Magento cant associate simple to configurable product

I created a configurable product and went to the associated products tab and used the quick create product feature to create a bunch of products based on my configurations. However non of these products appear in the list of associated products.
I noticed that the attributes I created don't even show up on the edit product page, on either the simple, or the configurable product.
I started first by creating 3 new attributes for a configurable product I want to add, I setup the options for each one and created a new attribute set based on default that included the new attributes I created.
When I create a new simple product or configurable product, you cannot see the attributes I have created. I have tried with the attributes in the general tab as well as on their own tab. But they are never visible when you try to edit the product.
I'm suspecting the reason I can't associate the products is due to this strange problem
I'm using 1.4.2
[edited to add my work flow/screen grabs]
http://www.buggyonpurpose.com/magento/configurable_products/01-attirubte_set.png
http://www.buggyonpurpose.com/magento/configurable_products/02-create_configurable.png
http://www.buggyonpurpose.com/magento/configurable_products/03-setup_configurable.png
http://www.buggyonpurpose.com/magento/configurable_products/04-quick_create.png
http://www.buggyonpurpose.com/magento/configurable_products/05-associate_product.png
http://www.buggyonpurpose.com/magento/configurable_products/06-manage_products.png
http://www.buggyonpurpose.com/magento/configurable_products/07-edit_product.png
It took a while but finally figured it out. When I created my attributes, in Attribute Properties where it says "Apply To:" I had only assigned it to configurable products, but you must also assign to simple products as well. (or just apply to all)
Keep in mind you will have to recreate your original configurable product before it will work.
Assuming you have created attributes with options and attribute set.
Can you please createConfigurable product again
Manage products -> Add Product select your default attribute set and Configurable product option.
The next window will be to choose the attributes that you have have created.
Lets say that there are three attributes color, fragrance, and volume as three different attributes and you pick fragrance here to associate the Configurables to the simples which you will be creating.
After you successfully created the Configurable product.
Create simple products based on the same attribute set default
you must be able to see all the attributes you created(color, fragrance, and volume).
Please pick any option for the Fragrance attribute.
Go to the Manage Products ->select to edit the Configurable product you have just created.
Go to the "Associated Products" tab and select "Any" from the drop down on the extreme left.
You must be able to see the Simple which you have created now
you must also be able to see the parent-child linking attribute "fragrance" present above the grid of products.
Make sure the simple is in "In stock" before you see whether they appear in front end.
Its not necessary for the attribute to appear in the Configurable product edit page.
Follow the above steps, hope it will guide you.
Please let me know if you unable to follow any of the above steps.
You can also read the below link, which is very useful to create a config product.
http://www.magentocommerce.com/knowledge-base/entry/tutorial-creating-a-configurable-product/
Cheers
I had the same issue.
A possible workaround is to add the attributes in the single products and after they become available through the configurable product at "Apply To:".

Magento: Different products in the different store views under the same store?

I have multi website, multi stored Magento shop, and I have a need to make some products available in one store_view, but not available in the other, where both store_views are part of the same store and website.
All my products are configurable with simple products attached to them. Only way I could think of solving this is registering a new product attribute through which I control where each product goes. That works great for the catalog and lists of products, but I have huge problems with single product view and choosing the configurable product options.
I can't seem to find where in Magento core those option are generated, so I could override that and strict some options for each store view. Basically, I need to know where is this
generated. My last resort would be managing this through AJAX, but there is already a lot of AJAX code and calls in that page that it would be confusing.
Any help or tip would be very appreciated.
I am pretty sure that the way above is not working because the attribute enable/disable product has impact at website level and not store or store view!
So if you do like tomakun says the product will be disabled at the whole website and not just for the store view you choose first!
I have the same problem that I want to assign different products all to one website but to different stores.
So far I just found the solution above to change the visibility at store view level.
But I think this not the optimal solution. It should be possible to disable a product on store level!
This feature is already available by default in Magento.
For bulk enabling/disabling products for a particular store view, do the following:
Go to your Catalog > Products
Select a store view above the product list.
You are now viewing all products included in THIS store view.
Once you have the correct store view selected, select the products you want to Enable or Disable using the checkbox on the left.
Now, using the Actions dropdown menu on top right of the product list, choose 'Change Status', select 'Disabled' or 'Enabled' and hit the Submit button.
Doing this will Enable or Disable the selected products from the selected store view (step 2). This is good for bulk actions but you can also do the same for all products one by one:
Open your product, select the relevant store view on top left of the page. Then in the General Tab, you have status: Enabled or Disabled. Choose the option that you want to apply for the current store view and hit Save.
That's it!

Resources