Magento 2 stores with different product url - magento

Here is my situation, my company buy product with no brand and sell them in its own brand.
We have 2 websites and 2 brands, some products exist in both of our brand with different name.
Example : product A of brand A named BrandA Product Premium and the same product on the other site is named BrandB Product Super.
But on both website the url-key is the same (the name of the product in the default view) so on site1 I have :
http://www.site1.com/brand-a-product-premium.html that is very good.
On site2 I have http://www.site2.com/brand-a-product-premium.html If you type in the correct url : http://www.site2.com/brand-b-product-super.html you are redirected to the bad url.
I can correct this by creating a custom url_rewrite, but there are thousands of product in this case, so I may have done something wrong and there should be a better solution for this.
May I have some help ?
Best regards.

If you are using one instance of Magento in a multistore setup you can override the url key as well as any other product attribute for each store view. Select the store view for site 2 from the dropdown on the left hand side of the edit product page and then override the required fields for that store view.
I have a multistore site where I sell some products on both but not all and using the above method gives me full control over every aspect of the same product for each store view. e.g. Custom name, description, images, categories etc. To ensure that a product is not shown on a particular site via catalog or search, I disable that product in that store view by setting visibility to none.
Do not use the URL rewrite option this will come back to haunt you!

Related

How to create different URLs for items in a drop down list on a product page?

I am not a coder, and I am working for a company involved in e-commerce activities, so please help me!
Currently we are looking to merge two different aspects of the business, where we will have the other company arms website detailing the product variations (i.e. Product A in sizes 1, 2, 3 and 4) on their page as separate enteries as part of their mission driven section, which link directly to our product page.
The issue we have is, on our website we have a drop down menu, and what we want to achieve is for the when the visitor selects the buy on the product page for Product A in Size 2 it links directly to our ecommerce page with a pre filled in drop down menu for that exact product selection.
Does anyone know how we could achieve this in Magento? Could this be done in custom URLs?
Thanks in advance!!
To preselect a simple product in a configurable product, the address of a simple product should look like this for example:
/mona-pullover-hoodlie.html#143=167&93=53
where /mona-pullover-hoodlie.html - configurable product URL,
143, 93 - attributes IDs,
167, 53 - option IDs.
In order to change the URL of simple products, you can create a Plugin (Interceptor) for Magento\Catalog\Model\Product::getProductUrl(), where to generate the URL as in the example above.
I made VCT Simple Product URL module on Magento Marketplace that solves this problem.

Create magento product that links to an external website

I want to add a product that is not held on my magento website. It must only show on my website. But when a customer clicks on a product it directly goes to the website that holds the product.
I want to give the URL to the product on the site. I am not sure how to do this. Please help me. Thanks.
Here are some screen shots that show what I actually want to do:
product show on my website
Customer goes to other website
The way i would suggest you is to create an attribute called external_url, a textinput field. Assign it to required attribute sets then, while adding product if that particular product will be linked to external; input that field with external url.
And while populating product in listings, check if that external_url attribute value exists or not. (for eg on template/catalog/product/list.phtml check for this value $_product->getData('external_url'))
If the value exists then, change the product link(on product list.phtml change $_product->getProductUrl() with our $_product->getData('external_url'))

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

magento link product to specific store view

I have 6 languages defined using store views.
i have 6 simple products - one product for each language.
I did not create those products using attributes or configurable product or so, since this is the main product in my store and i would like to promote the product in each language separately.
now, I try to link a productX to default store view X (means if someone clicks to view that product, he will move to the store view with the language of the product.
example:
- store view_EN
- store view_IT
product X_EN
product X_IT
being in store view_EN, clicking product x_IT should redirect to store view_IT/product X_IT...
is that possible with little tweaks only?
thanks!
First of all, you don't need 6 different products, one for each language. You can have the same product, and translate the text fields to all the languages (like name, description, short description, ...).
You can do that by changing the scope from the top-left dropdown on the product edit page, in admin.
Now here is how you can get a product url for a specific store. Let's say that the product id is $productId, and the store id is $storeId
$url = Mage::getModel('catalog/product')->setStoreId($storeId)->load($productId)->getProductUrl()

Magento. Redirect to specific store view

We have multi-website(5) multi-store-view(13) shop.
What we need is that only 3 store view from 1 shop are allowed to checkout. Therefore the problem is how to redirect users from other shops to the same products on specified store view.
For example user watches product on mk_nn_eng and click #Button#, after that he is redirected to mu_aa_ENG AND sees the same product, he was observing but on specified store view.
How to perform such redirect?
If it's the same item, it will have the same id. And you can link to an item by it's id using the format (assuming you have different domains set up for each view):
www.DomainForStoreViewYouWant.com/catalog/product/view/id/{{product.id}}
Where you would get the id with something like $product->getId(); depending on the product object in the file you're looking at.
So the button you mentioned would just be the above link.
Is this what you had in mind?
Update:
If it's the same domain for each view, you could add the storecode to the end: ?___store=storecode

Resources