Opencart language picker wierdly not working on few pages - php

I have this wierd problem, on opencart 2.xx i have 2 languages and the language switcher is working fine on some and doing nothing on others, added to this language is randomly switching as i go through page.
I have no idea whan can cause this so i cant provide specific section of code.
I discovered that it works fine on pages that have some kind of imput, like login, register, cart, checkout etc.. And not working at all on others, dunno if its related tho.
Also theres this problem, also in header so maybe its corelated, when i add item to cart, go to different page, cart shows 0 until i hover it, after i hover it immediately shows correct number.
Example of page with NOT working switcher: http://corddecker.com/index.php?route=product/category&path=25_29
Example of page with working switcher: http://corddecker.com/index.php?route=account/login
If you can just check that behaviour and give me some idea what can be causing this, would be awesome because i have no idea.
Thank you

I've notice your theme is calling magnificPopup function in this address:
http://corddecker.com/index.php?route=product/category&path=25_29
And jquery.magnific-popup.min.js is not included in your theme.
This caused and error that can affect some of your other codes.
As by default Opencart 2.x comes with a copy of jquery.magnific-popup.min.js try to add this to your header.tpl:
<script type="text/javascript" src="catalog/view/javascript/jquery/magnific/jquery.magnific-popup.min.js"></script>
and make sure the file exists on that directory.

Related

Restoring Deleted Front Page in WooCommerce

I was trying to get rid of the Welcome section on the front page of a WooCommerce site I am building. The site is using the Storefront theme.
I thought the way to do it was to delete the Welcome page from the Pages section of WordPress. However, as soon as I did that, the entire front page of the store is gone and it is back to what seems like a regular WordPress.
Using "Create default WooCommerce pages" feature of WooCommerce does not seem to work as it neither fixes the display of the front page nor creates another Welcome page.
I have several questions.
1. What went front?
2. How can I fix it, so the store displays again.
3. How can I get rid of the Welcome section on the front page without blasting the entire page off the site?
Any advice is appreciated.
P.S. I should mention that I originally moved the Welcome page to trash. I then saw that it broke the site. In turn, I attempted to restore it, but it didnt fix the issue. I then deleted the page permanently in hopes of recreating it with the WooCommerce functionality. The latter didnt work.
You need to use the WordPress theme Customizer
under front page you have the option to choose a page your blog as a front page, here you just need to select the page that you deleted and then restored
this link may be of some use to you... https://atlantisthemes.com/change-storefront-homepage-layout/

Woocommerce shop page redirects to wp-admin

At some point, the shop page started to redirect to the wp-admin (admin backend) page. I don't know why.
Commonly proposed solutions include:
Delete the shop page, and add it again using the WC > Status > Tools > Create default WooCommerce pages.
Make sure the WP URLs are set correctly.
Neither had any effect. The shop page URL is currently at https://website.com/?page_id=88, reflecting the number of times I tried remaking default pages.
I have also tried adding some text to the page, though it should normally be empty. This had no effect.
Ran out of ideas to try. The rest of the website mostly works.
Possibly related annoyance bug: the shop automatically adds the first product to the cart whenever one visits the site. Somewhat annoying, but not disastrous.
Versions:
WooCommerce 3.2.6
Wordpress 4.9.1
The bug seems to be fixed by changing the Home page to the Shop page in the WP settings > reading.
Unfortunately, this workaround doesn't fix the underlying issue entirely because the bug resurfaces if one selects the front page instead of the shop as the home page.
I'm not able to add a question/comment, so I'll try to add this as an answer...
If you are using IIS and have setup your site as a virtual application, this may cause this error. I had this same thing during testing. Once I created the website as it's own proper website and accessed it properly, this fixed the issue for me.
I had this issue and fixed it clearing browser cache
I hope it helps

Wordpress woocommerce weird problems

First of all, thank you for bothering to read this topic, I feel like this is going to be a long and painful one, as I'm trying for about 7-8 hours now to get what the hell is happening with this plugin.
I am a developer, so I know what I'm doing, and this isn't my first page I did using WordPress.
The problem started when I started reading up on woocommerce's documentations which are widely known as quite poorly documented.
Since I made a custom theme, which I have had before already, I've decided to use the overwrite method as well as the woocommerce.php method for customizing the plugin to fit the site as I'd like it to.
The woocommerce_content(); is customized now, and nicely working as well as the product pages (single product page) which are customized as well, and working.
As soon as I try to access the account features, nothing happens. I've tried adding echoes for debugging purposes to the my-account.php, but it does not echo what I write, so I assume the shortcode cannot load for some reason, because it does not reach the my-account.php page as it should, and it points somewhere else perhaps?
Then I've noticed that when I click the "Add to cart" button, it appends the element with a "View cart" button as well, so me thinking this is working, I left it as it is. For like 5 seconds, because right after a page refresh, or navigating to another page, the content of the cart gets empties, I cannot even see the cart page, nor the login page, nor the create account page, or anything in fact.
Everything is working that is inside my "wp-content\themes\mytheme\woocommerce" folder, but nothing else that is inside my
"wp-content\themes\mytheme\woocommerce\any-subfolder"
The woocommerce system status does not show any error, nor the PHP error log, nor anything else.
I have a VERY long list of "Overrides (WooCommerce):" which I don't want to paste here because of reasons.
The only success when I was able to at least get something out from the plugin, is when I used the wordpress function "do_shortcode();" and added the myaccount or cart shortcode myself to a page, THAT worked, and printed it out, however I'd like to use the original method, so the code won't get too complex for later on.
Every other site is working fine, I'm currently running this on localhost, cookies working, sessions working, I log everything yet there is no error, mod_rewrite working correctly, yet I am stuck.
Looking for a patient gentleman to help me on this painful day...
EDIT:
Added "[woocommerce_my_account]" to the "shop" page which page's file is the "woocommerce.php" has actually loaded up the correct my-account.php from "themeroot/woocommerce/myaccount/my-account.php" It echoes out my debug messages as well, so the shortcodes should be working, perhaps this isn't just a woocommerce related issue?
EDIT2:
After fiddling around a LOT, I've come to understand that the wrapper hook it is supposed to do (div id=content and div id=main) does NOT get hooked in it, perhaps it is just a small problem, since I've removed them with remove_action, and the "Shop" page still displayed properly... I have NO idea what is going on with this plugin, but I don't have the luxury of time to fiddle around with it... This is such a pain...
EDIT3:
The plugin works perfectly on any other basic theme, so there is something up with my custom theme. Even after hours of searching the differences between the default theme (twenty-fifteen) and mine, I have not found the solution.
I have solved the problem... It is of course entirely my fault, the problem is just that woocommerce has so poor documentation, I did not really thought about this.
For anyone out there creating custom themes for WordPress, please note that in order for your page.php to actually use the shortcode of the page you have navigated on, you must print out the content of the page (the_content();).
This was my solution for my mistake that took many many hours...

Woo Commerce Add to cart is not showing on Variable Product

I am using Woo-commerce for online shopping.
I create some variable products, but when I am going view full page of product it says
Add to Cart is Hidden
I tried forcefully show the "Add to cart" button using display: block in CSS but when I click on that it gives me error
Please choose product options
Also there is no error in developer console
Can anyone know what exactly happened or where I am wrong or is it a script problem?
For anyone else who finds this, the wc-add-to-cart-variation script is loaded by WooCommerce in the footer. So, if it isn't loading your theme either 1. doesn't have wp_footer() (which is rare as even crap themes should have this) or 2. there is a PHP error in the theme templates and the page is not fully loading.
I would suggest checking the latter point. You can view a page's source code. In Chrome just type CTRL+U.
Scroll all the way to the bottom. The last thing you should see is:
</html>
If you don't see this the page didn't load fully, likely do to a fatal PHP error.
You can find out exactly where by enabling WP_DEBUG in your wp-config.php file.
If anything, I'd guess that your theme has some WooCommerce templates that are out of date with respect to the current WooCommerce. This post is old, but this keeps happening as WooCommerce keeps evolving and themes keep packaging templates that they don't even modify.
This issue is probably caused by an outdated single-product/add-to-cart/variable.php template. But if renaming that doesn't solve it, in a pinch you can always disable your theme's entire WooCommerce templates by renaming the WooCommerce folder in your theme to anything else. 99% of the time it will be called woocommerce, but it could be something else.
WooCommerce will now let you know which templates are out of date. This information can be found in the admin under WooCommerce>System Settings.
Another good read would be:
http://develop.woothemes.com/woocommerce/2014/02/solving-common-issues-after-updating-to-woocommerce-2-1/
Did you set a price for your product? If not, the Add to cart button will stay hidden.
add_action('wp_head','add_to_cart_script');
function add_to_cart_script(){
if(is_product()){
wp_enqueue_script('wc-add-to-cart-variation');
}
}
There was Jquery problem add-to-cart-variation.js was not included.
Now its working fine for me...
I managed to display the 'Add to cart' button as follows:
Locate the variable product template file in your theme directory:
templates/single-product/add-to-cart/variable.php
Add this code to the end of that file:
<script>
$(window).load(function(){
$(".single_variation_wrap").show();
$(".single_add_to_cart_button").click(function(){
if($("#pa_size").val() == ''){
alert('Please select size');
return false;
}
});
});
This is what I used. Maybe you have other fields and/or classes/ids. Just play around, I hope it will work for you.

Order details not displaying (WooCommerce)

I'm having a strange issue with a site I'm designing. I'm using the WooCommerce system up and running and am using the Wootique theme. I've edited a bit but nothing too major, mostly just colours.
What's happening is, when I go to buy something and checkout, I am able to enter my details but nothing appears under the YOUR ORDER header. The NEXT/CONTINUE button is missing also, so I can't go any further.
Has anyone else experienced this? I can't seem to figure out why it's happening or how to fix it?
The test site is at http://kelvinwinscom.fatcow.com/
I ran into the exact same error on my woocommerce set-up. In my situation, it was a conflict with jQuery.
Woocommerce loads the latest version of jQuery in your themes head section. I was manually loading an older version of jQuery in my themes footer. Having the two copies of jQuery was breaking the "order" section, causing nothing to load. By removing the jQuery copy I was manually adding, the problem was resolved.
It may be likely that you've done something similar, or that you're using a plugin that is adding jQuery in a non-wordpress manner (Not using wp_enqueue_script and other script registering and enqueue-ing functions)

Categories