Alternative URL for shop in WooCommerce - php

I am having an eCommerce shop based on wooCommerce Platform for WordPress. If I access the shop page like http://mysiteurl/shop then it shows the available product list.
My requirement is to have an alternative URL of shop for sponsors like http://mysiteurl/shop/sponsor/sponsorname. I need this link to track which order is sponsored by which sponsor, so that I can give appropriate commission to my sponsors.
I don't have too much knowledge of php/wordpress/woocommerce but after doing some R&D I am able to create alternative URL for shop as required by URL rewriting. For URL rewriting I have done following code in functions.php under theme folder.
add_action('init', 'custom_shop_sponsor');
function custom_shop_sponsor() {
add_rewrite_tag('%sponsor%','([^&]+)');
add_rewrite_rule('^shop/sponsor/([^/]+)/?$','index.php?
pagename=shop&sponsor=$matches[1]','top');
}
After doing above code I am able to access the shop page with desired URL like http://mysiteurl/shop/sponsor/sponsorname but on this page no product list is coming. It is just showing text "Showing The Single Result"
Why are products not coming? Also please suggest any if any other solution exist for my requirement.

Related

Woocommerce Storefront Theme; Show "available on backorder" on checkout page, on the individual product

Hello i'm on my first webshop project, and mostly been doing normal wordpress websites in the past. I am making the shop with woocommerce and the storefront theme.
On the website the owner want the customers to be able to see the "available on backorder" message that i linked in the first image to where the red line is on the second image.
The first image is from the shopping cart page, and the second is on the checkout page.
Picture one of the shopping cart page and Picture of the checkout page
So the problem is i dont really know how to add the code for showing it on the individual product on the checkout page.
Since im still pretty new to the add_filter or function coding, i dont really have anything to show other than the two related pictures I hope the question makes sense, since english isnt my first language.

Link shop page to external link in woocommerce

i'm using shopkeeper theme in wordpresse, and i have only affiliate products on my website, so i want to send visitors directly to the external website if they click on a product in the shop page.
I've found similar questions in the forum but it didn't worked for me.
I heard that there are plugins to do it but i dodn't find them.
Anyone has a trick please? Thanks in advance!
In single product page you have to select "External / Affiliate product" in product data section and then enter the external URL. In this case when someone clicks on your products they will be redirected to the external link you have assigned to each product. You can use WooCommerce External Product New Tab plugin to open the links in a new tab.

Adding Google Image search button to Wordpress site

I want to create an e-shop and I want to redirect customers to google images to see photos of the produc (if there are). How can I retrieve the product sku and provide a button which directs (in a new tab) customers to google images search results by that sku?
thanks in advance
Google Image search can be done on your page by going through this tutorial on Google's website TUTORIAL
As far as retrieving the product SKU, that depends how you saved the product SKU in the database. If you are talking about the manufacturer's barcode, I don't think you can just magically come up with that. You should save the barcode in a custom field for each product in your database, then call the custom field using the Wordpress function get_post_meta

Magento - Products not showing on "not visible individually"

I've got a website with Magento Enterprise Edition's 1.14.1.0.
If I set my product's visibility to "not visible individually" it will return 404 error when I try to access their details page directly using url.
Any idea/suggestion would be appreciate. Thank you.
Magento has functionality to make certain items not visible individually so you can, for example, take 6 products and turn it into 1 product where a customer can choose their options.
You then hide all the individual products, leaving only that one product visible on the site and reducing duplicate content issues.
So those individual pages never actually appear on the site. They are just created to allow Magento to pull inventory on those items from that configurable product.
I would get a 404 (and if I searched for it, nothing would come up) because as far as the world outside of Magento admin is concerned, that URL doesn't exist.

How to make dynamic Product URL key in phtml file for magento shop

I want to make a "shop online" link on the B2B Magento shop product page (http://b2b.com/product1/) to redirect visitors to the B2C shop product page like: http://b2c.com/product1/
I only know that <?php echo $_product->getProductUrl() ?> is calling http://b2b.com/product1/ But how to call a dynamic URL key in the /product/view.phtml, so then in the URL structure only the domain is changed from b2b.com to b2c.com but the product key will stay the same according to which product is being viewed?
Okay, I found a solution that is exactly what I want to achieve:
ProductName
Then the URL link will be shown as google.com/ProductName

Categories