w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Separate Nginx Rewrites
Ok since you said it works let me explain what you did, I'll quote them from the wiki page: First the flag you used which is break break: completes processing of current rewrite directives and non-rewrite processing continues within the current location block only. by adding the keyword break to any rewrite rule, it tells nginx to stop the rewriting, so even if it matches another location which has a rewrite, it wont run it, that's why it didn't execute the rewrites inside the location location / { .. } Another keyword is last, last: completes processing of current rewrite directives and restarts the process (including rewriting) with a search for a match on the URI from all available locations. This one which tells nginx to stop the rewriting and restart rewriting again wi

Categories : Nginx

IIS 7 aliases/rewrites between two applications
Like Lex said in IIS.NET since the request doesn't ever reach IIS you cannot modifyupdate it in anyway. However, have you considered setting up a separate virtual directory or application within IIS named (app1alias) that just points to this location (app1) ?

Categories : Asp Net

301 Redirect/Rewrites with Patterns
Use a RedirectMatch instead: RedirectMatch 301 ^/collection/([^/-]+)-active/(.*)$ /collection/active/$2 Assuming by the "is the changed part", you mean there could be anything where it says "womens-". EDIT: Since it's the other way around, just swap the regex grouping and the "womens-": RedirectMatch 301 ^/collection/womens-([^/-]+)/(.*)$ /collection/$1/$2

Categories : Regex

Why Apache mod_rewrite rewrites twice my URL?
Well, I finally solved this issue using a workaround. First I tried these solutions, but subrequests were performed again and again and rewriting failed as before. With mod_rewrite, there are small differences if you put a rule in .htaccess or in global configuration (httpd.conf, Virtualhost configuration, etc.). Subrequests are one of that differences. Just place the same rule I mentioned above in Virtualhost config file instead of .htaccess and subqueries stop and everything starts working like a charm. I recommend this useful post to fully understand the internals of mod_rewrite before trying to solve any related to it issue: http://net.tutsplus.com/tutorials/other/a-deeper-look-at-mod_rewrite-for-apache/

Categories : Apache

NGINX rewrites with regular expression
Please try with this try_files $uri/index.html $uri @moved; location @moved { rewrite ^/categories/(.+)-c-(.+)$ "/categories/$1/$2" permanent; } And be careful with the slashes, Since $URI always start with a slash (/), so after redirecting to the new 'moved' scenario it should be like the same.

Categories : Regex

NSMutableArray addOject rewrites data
This is not an overwrite of a previously added object - the reason you see this is that you have added a reference to the same object two times. Your NSMutableArray looks like this: [_singleBtn, _singleBtn] NSMutableArray does not make copies of objects that you insert, so you need to take care of making new objects before inserting them. One way of making a copy is passing _singleBtn to a method that copies it into a new dictionary, like this: [_buttonArray addObject:[NSMutableDictionary dictionaryWithDictionary:_singleBtn]];

Categories : Iphone

url rewrites removing folders .htaccess
The problem should be on the last rule: what you need is a negative look behind ie anything not preceede with articles/artificial The regex should be: ((?<!(articles/artificial)).*) But this probabilly does not work since the .* is variable length (see regex look arrounds) A solution could be replacing the negative look behind with a positive look ahead that allows for variable length. So your rule could be: RewriteRule ^(?!.*?articles/artificial.*?)(.*)$ /articles/artificial/$1

Categories : PHP

My one-line-rewriter only rewrites part of a script
It is possible that you are having the problem because of mixed newline types: Try this: from sys import argv script, input_file = argv def make_one_line(f): uncommented_lines = (line.rstrip(' ').split('#')[0] for line in f) # return ';'.join(uncommented_lines) #print "This will rewrite the file, press CTRL-C to cancel." #raw_input('Press any key (but CTRL-C) to continue.') current_file = open(input_file, 'rU') # Open in universal newline mode final = make_one_line(current_file) current_file.close() outfile = open("out_"+input_file, "wt") # Save the output in a new file outfile.write(final) outfile.write(' ') outfile.close()

Categories : Python

multiple internal rewrites not working as expected
You need to check that the html exists before you apply the rule. You can do this with a condition: RewriteEngine On # extract the pathname into a capture group RewriteCond %{REQUEST_URI} ^/(.*?)/?$ # test to see if the pathname + .html exists as a file RewriteCond %{DOCUMENT_ROOT}%1.html -f # if both conditions are true, apply the rule: RewriteRule ^(.*?)/?$ $1.html [L]

Categories : Apache

CouchDB: Trouble querying a view with a key using rewrites
It's likely that the rewriter is querying zip?key=":zip" rather than zip?key=:zip. You can use a formats field in your rewriter to name how different arguments should be typed. In this case, try this: { from: "/zip/:zip", to: "_view/zip", query: {"key": ":zip"}, formats: { "zip": "int" } } Alternatively, in your map function, emit a string as the ID rather than a number, like this: function (doc) { if(doc.type == 'zip') { emit(String(doc.zip_code), doc) } } That will handle cases where the zipcode isn't an integer, like in the UK.

Categories : Misc

How does the new Magento1.13 EE URL rewrites work/ How do the new database tables relate to each other?
It's difficult to answer your question, as the new Enterprise URL rewrite module has undergone and is still undergoing very significant changes. A stable version is expected with the next release (1.13.0.2), but until then, no one outside of the Magento core team can tell you exactly how the rewrite module will look and work. The gist of the new setup, though, is that Magento now pulls rewrites from enterprise_url_rewrite, and all the other tables you identify are used to rebuild it during the reindexing process. All the releated tables ending in _cl are change logs that are tied to database triggers.

Categories : Magento

Apache .hatccess rewrites not working for legacy URLS
The first thing is the stray RewriteCond %{HTTPS} !=on that you have at the top. It looks like it belongs to the rule under it, as in: RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} !^www..+$ [NC] RewriteCond %{HTTP_HOST} (.+)$ [NC] RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L] As far as the rule that you have commented that doesn't work, the ? is a reserved character for regular expressions, and your pattern actually says that the second p in /index.php is "optional". Additionally, you can't match against the query string in a rewrite rule, you need to use a rewrite condition and match against the %{QUERY_STRING} variable: RewriteCond %{QUERY_STRING} ^option=com_chronocontact&Itemid=54$ RewriteRule ^(index.php)?$ /contact/? [R=301,L] is probably more along the lines of what

Categories : Apache

.htaccess rewrite rule to prevent image url rewrites
RewriteEngine on RewriteBase / RewriteCond img/_product/$1/$1A.jpg !-f RewriteRule ([0-9]+)/(.*)$ user/product.php?id=$1 [PT,L] Perhaps that will help. Fixed.

Categories : Htaccess

Does storing URL rewrites in a separate file override manual entries?
Well after much consternation and research, I stumbled upon this question and the highest voted answer, and it's working for me now with the rewrite rule still in rewritemaps.config. Changing {REQUEST_URI} to {PATH_INFO}

Categories : Asp Net

Wordpress subdomain integrated with existing website rewrites urls
In my case, it was a weird thing. If I had a post called "Foo bar", the page example.com/foo-bar worked. If I deleted the post, the page didn't work anymore. So my "solution" was to add articles that were named like my URLs... and hide them somewhere.

Categories : PHP

Media Query width-based CSS not rendered after AJAX rewrites some content
You would want max-device-width as the browser is changing the current width to match the content (leading to scrolling or scaling and no longer matching your media rule.) Take a look at: What is the difference between max-device-width and max-width for mobile web? EDIT: Here is a much better link on more options and iphone specific oddities: http://www.quirksmode.org/blog/archives/2010/09/combining_meta.html I also made a little detector to get at the actual numbers: http://jsfiddle.net/JztA4/2/ <html> <head> <script> var s = ""; for (var i = 0; i < 4096; i++) { var dev = i % 2 ? "device-" : ""; s += " @media all and ( min-" + dev + "width:" + i / 2 + "px) { #" + dev + "width:before { content:'" + Math.floor(i / 2) +

Categories : CSS

wpf: setting of ItemsContainerStyle rewrites all custom style of custom TreeViewControl
You can just Base it on whatever existing style you want and only modify the stuff necessary for the instance like you're doing using the Style BasedOn Property like; <Style TargetType="TreeViewItem" BasedOn="{StaticResource YourExistingStyleYouWantToBaseItOn}"> <Setter Property="Background" Value="Red"/> </Style> Hope this Helps.

Categories : Wpf

woocommerce get_woocommerce_currency_symbol()
Your code should work, which means the issue might be in the database. You can check this 2 functions:get_woocommerce_currency() and get_woocommerce_currency_symbol() from the woocommerce docs that shows that you are using the functions correct. What is left is for you to start some troubleshooting steps to see what causes the error: what is get_option('woocommerce_currency') returnning? if nothing then you have no currency set and that is why you get nothing from get_woocommerce_currency_symbol(); What happens if you add a currency as a parameter to get_woocommerce_currency_symbol? it gets displayed? something like echo get_woocommerce_currency_symbol("USD"); You should add to your script some error handling lines, to inform the user that he needs to have the currency set before using

Categories : Wordpress

I can't pay with Paypal through WooCommerce
Sounds like maybe you've got WooCommerce set to run in test mode but you're using your live PayPal account credentials to try logging in. That won't work. If you are indeed set to test mode you need to create test accounts to play with at http://developer.paypal.com. Alternatively, just set WooCommerce to run in live mode and then your live PayPal account credentials would work, although, you'll need to a live PayPal account separate from your seller account because you can't pay yourself.

Categories : Paypal

FirstData with wp-woocommerce
you have to take SSL licence from your web hoster for yor site After installation if that will not work then try to add below code in your function.php of theme for particular page with ssl add_action('wp_head', 'apply_ssl_to_specific_page'); add_action('admin_head', 'apply_ssl_to_specific_page'); add_action('login_head', 'apply_ssl_to_specific_page'); function apply_ssl_to_specific_page(){ <?php if ( is_page('your-checkout-page-slug') ) { if($_SERVER['SERVER_PORT'] != '443') header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); } else { if($_SERVER['SERVER_PORT'] == '443') header('Location: http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); } } replace your-checkout-page-slug with your page sl

Categories : Wordpress

Get customers name in Woocommerce
You need the order object, so depending on what hook you are using it should be there. Try something like this: add_action('woocommerce_order_status_completed','my_woo_email'); function my_woo_email($order_id){ $order = new WC_Order( $order_id ); $to = $order->billing_email; $subject = 'this is my subject'; $message = 'Hi '.$order->billing_first_name.' '.$order->billing_email;$order->billing_last_name.', thanks for the order!'; woocommerce_mail( $to, $subject, $message, $headers = "Content-Type: text/htmlrn", $attachments = "" ) } This is untested but should get you started

Categories : Wordpress

woocommerce hook on page-new.php
You can fire your hook selectively using: add_action( 'load-post-new.php', 'your_callback' ); And then check for the post type before adding the hook: function your_callback() { global $typenow; if( 'product' != $typenow ) return; add_action( 'edit_form_after_title', 'myprefix_edit_form_after_title' ); } Or, another option: add_action( 'edit_form_after_title', 'myprefix_edit_form_after_title' ); function myprefix_edit_form_after_title() { global $pagenow, $typenow; if( 'post-new.php' != $pagenow || 'product' != $typenow ) return; echo 'This is my text!'; }

Categories : Forms

Woocommerce / Wordpress - Out Of Hours
You could use the Catalog Visibility Options extension which allows you to disable the cart. Sadly, you would have to manually turn it on / off during the day for it to work. You would probably want something more automated.

Categories : PHP

Modify WooCommerce Is_Purchasable
Not sure if it solves the issue as this has to be tested on your own custom set up. But you're using get_field wrong: if it is not used inside a Loop, you should provide the post ID. Analyzing the filter woocommerce_is_purchasable, we see that it takes two parameters, a boolean (is_purchasable) and an object (WC_Product). Try this: add_filter('woocommerce_is_purchasable', 'preorder_is_purchasable', 10, 2); function preorder_is_purchasable( $is_purchasable, $object ) { // this is a field added using 'Advance Custom Fields' plugin $is_preorder = get_field('is_preorder', $object->id); if($is_preorder && $is_purchasable) return true; else return false; }

Categories : PHP

woocommerce how to create brands tab
Woocommerce has this feature built in. Please check out the Woocommerce Shortcode site to see what you can do already. But your shortcode will be: [product_category category="appliances"] Where "appliances" is the slug name of your category you want to filter the products by. See the Woocommerce Shortcodes here http://docs.woothemes.com/document/woocommerce-shortcodes/

Categories : Wordpress

Woocommerce - php to get order information
Recently i worked for Export of Orders Data in XML. $args = array( 'post_type' => 'shop_order', 'post_status' => 'publish', 'meta_key' => '_customer_user', 'posts_per_page' => '-1' ); $my_query = new WP_Query($args); $customer_orders = $my_query->posts; foreach ($customer_orders as $customer_order) { $order = new WC_Order(); $order->populate($customer_order); $orderdata = (array) $order; // $orderdata Array will have Information. for e.g Shippin firstname, Lastname, Address ... and MUCH more.... Just enjoy! }

Categories : PHP

In woocommerce, what determines the order_item_id?
Solved it. Open class-wc-cart.php, and add a timestamp, or anything else that is unique to $id_parts. Just like in the following code: public function generate_cart_id( $product_id, $variation_id = '', $variation = '', $cart_item_data = array() ) { $id_parts = array( $product_id ); if ( $variation_id ) $id_parts[] = $variation_id.time(); if ( is_array( $variation ) ) { $variation_key = ''; foreach ( $variation as $key => $value ) { $variation_key .= trim( $key ) . trim( $value ); } $id_parts[] = $variation_key.time(); } if ( is_array( $cart_item_data ) && ! empty( $cart_item_data ) ) { $cart_item_data_key = ''; foreach ( $cart_item_data as $key => $value ) { if ( is_array( $valu

Categories : Misc

WooCommerce - Sum of product_id values
Consider the following: Having an array of 100, 200, and 300 would add up to 600. $formatted_total = 5000; I substract $formatted_total by the $invoiceItems array, 5000 minus 600 equals 4400. <?php $invoiceItems = array(100, 200, 300); $formatted_total = 5000; $invoiceTotal = $formatted_total - array_sum($invoiceItems); echo $invoiceTotal; // will echo 4400 ?> echo $invoiceTotal(); would render invalid because you are trying to echo an invalid function. If I were to use the following: $invoiceTotal = $formatted_total - $invoiceItems; Will produce the following error: Fatal error: Unsupported operand types

Categories : PHP

woocommerce add-to-cart empty
in your server config file look for location / { $uri $uri/ /index.php it may be a little different depending on your server config but you should have a line with index.php Just add ?$args after index.php $uri $uri/ /index.php should look like this $uri $uri/ /index.php?$args Don't forget to restart nginx. This should fix the empty cart issue.

Categories : PHP

duplicate extension woocommerce
It is possible! i already created custom payment gatway for norway country Woo Commerce Provide Payment Gatware API. You should have to refer this guide in detail, also take idea of code structure from Default Payment under wp-content/plugins/woocommerce/classes/gateways/bacs

Categories : Wordpress

get woocommerce product variation id
Add the action like this: add_action( 'woocommerce_product_after_variable_attributes', 'wwp_add_variable_wholesale_price', 10, 3); function wwp_add_variable_wholesale_price($loop, $variation_data, $variation){ global $post, $woocommerce; $post_id = $variation->ID; echo $post_id; }

Categories : PHP

set wordpress woocommerce cart expiration
From what I can see, WooCommerce 2.0.20 has a scheduled maintenance job that runs twice/day that will remove any cart sessions from the WordPress options table. The default expiration time is set to 48 hours from the time the user first created the cart. I'm guessing your standard WordPress scheduling routines (and server cron/at jobs) will need to be running properly for this to execute. AFAIK there is no way to adjust the 48 hour rule via settings. You could write a filter in your theme or in an "adjacent" plugin. Here are some code fragments from a new "WooCommerce Extend Cart Timeout" plugin I built on my site: Inside my WoocommerceLicenseAPI class: if ( ! class_exists( 'WoocommerceLicenseAPI' ) ) { add_filter('wc_session_expiring' , array('WoocommerceLicenseAPI', 'fi

Categories : Wordpress

Migrate customers from Magento to Woocommerce
No, there isn't. As you noted, Magento stores its passwords with a salt password:salt Wordpress also stores its passwords with a salt — except the salt is an empty string and the same for everyone (i.e. Wordpress doesn't use a salt). The is a security feature of Magento's hashing, and is meant to stop exactly the sort of thing you're trying to do. In theory you could generate a rainbow hash table for each of the unique salts in the database, use this to crack your users passwords, and recreate them in Wordpress with a salt-less hashing. However, that's a non-trivial task if you're not familiar with the implementation of hashing algorithms, and would also take a significant amount of time. The usual approach to this is to create new accounts in the new system, and then automa

Categories : Mysql

Woocommerce add to cart ajax not working
Your cart is updating, but the number of products showed next to "Cart" in the cart button is not updating. I recommend you to use a plugin like "woocommerce dropdown cart widget" to integrate and show your cart easily.

Categories : PHP

Dependent Product Variations in Woocommerce
Basically you just need to remove the "small" variations with color. Make sure your color options are ordered after your size options in the attributes section of the product. Make sure you save. In your color options group create a transparent color. Remove all variations that include Small and a color except for small and transparent If a user chooses small, then they will only have an option for transparent I just did the exact same thing on a site.

Categories : Wordpress

Woocommerce check if coupon already applied?
Try this code. This will hide 'Coupon form' on checkout page, if any coupon is already applied from cart add_filter( 'woocommerce_coupons_enabled', 'woocommerce_coupons_enabled_checkout' ); function woocommerce_coupons_enabled_checkout( $coupons_enabled ) { global $woocommerce; if ( ! empty( $woocommerce->cart->applied_coupons ) ) { return false; } return $coupons_enabled; } Hope this will be helpful

Categories : PHP

Woocommerce Grouped Product Images
Here is the code you are looking for: add_action( 'woocommerce_grouped_product_list_before_price', 'woocommerce_grouped_product_thumbnail' ); function woocommerce_grouped_product_thumbnail( $product ) { $image_size = array( 20, 20 ); // array( width, height ) image size in pixel $attachment_id = get_post_meta( $product->id, '_thumbnail_id', true ); ?> <td class="label"> <?php echo wp_get_attachment_image( $attachment_id, $image_size ); ?> </td> <?php } Hope this will be useful.

Categories : PHP

Woocommerce - different attribute per product size
What you are looking for is a "variable product". When you create a new product, or editing some already created, take a look where it says "product type", choose variable, then select all the attributes that product will have under Attributes tab, then go to Variations tab and chosee those variations you whish to be available on product. This will add a select box that let you do exactly what you asked. See: http://docs.woothemes.com/document/product-variations/ http://www.youtube.com/watch?v=_qOmOIxpjDw

Categories : Wordpress

Hide Shipping Options Woocommerce
No doubt you have sorted this by now but your code was a good start for me ... and since I sorted it I have published it below. Your problem was that woocommerce doesn't have the product_tag in the cart array so you have to go and get it. /* !Hide Shipping Options Woocommerce */ add_filter( 'woocommerce_available_shipping_methods', 'hide_shipping_based_on_tag' , 10, 1 ); function check_cart_for_share() { // load the contents of the cart into an array. global $woocommerce; $cart = $woocommerce->cart->cart_contents; $found = false; // loop through the array looking for the tag you set. Switch to true if the tag is found. foreach ($cart as $array_item) { $term_list = wp_get_post_terms( $array_item['product_id'], 'product_tag', array( "fields" => "names" ) ); if (in_

Categories : Wordpress

woocommerce Customising checkout fields
try adding - woocommerce language support, which is for translators - check the add_action function in which you are adding it too - spacing can be a problem in the wrong places also to add language support, try so $fields['billing']['billing_state'] = array( 'label' => __('State:', 'woocommerce'), 'required' => true, 'class' => array('form-row-wide'), 'label_class' => array('infocounty'), 'clear' => true, 'placeholder' => _x('', 'placeholder', 'woocommerce') ); where i added "woocommerce" next to placeholder. :)

Categories : Wordpress



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.