Product Save from admin it's adding double html URL in table url_rewrite - magento-2.0

On Product Save from Catalog Admin section, it's adding double .html in URL in table url_rewrite

We fixed the URL's Suffix Issue like this:
By turning off Create Permanent Redirect URLs to NO in System > Configuration > Catalog > Catalog > Search Engine Optimization and once again try to save product.
If still not works then follow below steps :
Remove all product related rewrites from url_rewrite table
DELETE FROM url_rewrite WHERE entity_type = 'product';
Mass update all products in admin to do so :
(Select all Products,Select Update Attribute from Mass Action Dropdown,Select Website,Check the box underneath 'Add product to website' and click on Save)
Clear Cache
The URLs will also be regenerated then.
From now the URLs are correctly generated at each save of a product or category.

Related

Wordpress - Attachments block slugs

Summary: Some uploaded attachments automatically get slugs I later want to use for posts. It is impossible to change them without database access and very annoying.
Hi everyone,
I am using wordpress and lately uploaded some images.
Subsequently I was trying to create a post with a certain slug but wordpress automatically added a "-2" to it, indicating that there was already a page using the slug.
I entered the slug into my browser and it redirected me to an image I had uploaded. Weird.
I entered phpMyAdmin and searched the database for posts with the slug.
( SELECT * FROM wp_posts w where post_name like 'my-desired-slug'; )
In the database I found an entry of an object with post_type = "attachment". It has the desired slug assigned to it ("post_name"="my-desired-slug")
It is weird that wordpress assigned the slug to an attachment. This function is very unpractical. Now I had to edit the slug in the database since wordpress does not offer a UI section to edit attachment slugs.
In the admin you can go to Media, then select a image. In the detail page on the bottom right you can click "Edit more details". In the following screen below the title you can change the permalink!

Change woocommerce add to cart button to normal link

I would like to replace the Add to Cart button in woocommerce to a button that links to the "file url"specified for all downloadable products. I did find some plugins like "download now", but they expect an actual file while i often entered an url pointing to an external html page as file url instead of the actual file url.
You need external products instead of downloadable products. There are many plugins in the market which supports external products.
You can use default woocommerce feature. Follow these steps:
Make product Virtual & Downloadable
Goto Woocommerce >> Settings >> Products >> Downloadable products
Here for "File download method" option select redirect only
This will work as you want!

Server name in urls after domain migration - wordpress

I migrated a domain to a new server and now I see some url's with server name in source code, instead of domain name. For example:
http://servername.com/wp-includes/js/jquery/jquery.js
http://servername.com/wp-content/plugins/contact-form-7/includes/css/styles.css?ver=4.5
also can't login to admin panel via proper url:
http://my-domain.com/wp-admin
redirects me to
http://servername.com/wp-admin
Site works fine beside that. How do I set this up correctly?
In the wp_options table in the database, you'll need to change the siteurl value.
For full how-to see here
Backup your database and save the copy off-site.
Login to phpMyAdmin.
Click the link to your Databases.
A list of your databases will appear. Choose the one that is your WordPress database.
All the tables in your database will appear on the screen.
From the list, look for wp_options. Note: The table prefix of wp_ may be different if you changed it when installing.
Click on the small icon indicated as Browse.
A screen will open with a list of the fields within the wp_options table.
Under the field option_name, scroll down and look for siteurl.
Click the Edit Field icon which usually is found at the far left at the beginning of the row.
The Edit Field window will appear.
In the input box for option_value, carefully change the URL information to the new address.
Verify this is correct and click Go to save the information.
You should be returned to your wp_options table.
Look for the home field in the table and click Edit Field. Note There are several pages of tables inside wp_options. Look for the >
symbol to page through them.
In the input box for option_value, carefully change the URL information to the new address.
Verify this is correct and click Go to save the information.

Can the administrator attach a file to a Woocommerce order?

I was wondering what the best way to achieve the following:
Customer makes an order (normal functionality)
Once order is placed, the admin needs to upload a pdf attachment related to the order
The customer can then view the attachment(s) when viewing the order
I can see there are plugins where the custom can upload supporting files, but none that cater for the admin to do this.
Why not add a new custom field for that product?
(source: chizzledesigns.com)
So once your client generates the PDF they can upload it just like normal into the media gallery and add the link (or at least the file name) into the Order PDF field for that specific order.
Next you would need to decide how to show the user that in your theme but querying for that meta value should not be difficult.
With default woocommerce functionality the main way to do this is to create virtual downloadable product (but not available on shop pages) and upload your pdf file there. Then when the order would be ready, you should grant access to that virtual product at the order edit page.

WordPress category link

I am trying to create an online store from scratch, with categories and product pages.
Since is my first WordPress store I'm stuck on this trivial problem which stopped me on my way.
The permalinks are set to Month and name just to know the settings.
I created several categories where I want to insert the future products.
The problem arise when I try to access a certain category link - www.mysite.com/category/books/ - it displays the error page.
If I access www.mysite.com/category/ it shows me the content of the category page created in the admin panel.
All I want to do is to display all books when the visitor clicks on www.mysite.com/category/books/ and so on.
It is simple. Go to wp-admin/options-permalink.php and make your own settings: /%category%/%postname%/
And add a prefix on the field below: category or whatever you want
Read here for more options
Actually I solved it in another way, by modifying the category.php page.
There I inserted this code :
$uri = $_SERVER['REQUEST_URI'];
$elms = explode('/', $uri) ;
$catName = $elms[4] ;
and it does the thing I need.

Resources