opencart current url

the seo guy requested to add link to current url to each H1 in the site so i found this code to do this


  <?php  $url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>
  <h1><a href="<?php echo $url; ?>"><?php echo $heading_title; ?></a></h1>

making new option value column from 2 columns

i have this excel file which contains 2 columns of city names and city code i wanted to make from this 2 columns a new column with this  code

<option value=960>city name </option>

and i found this useful formula (thanks to jamal)

=CONCATENATE(“<option value=”,A2,”>”,B2,”</option>”)

when u put this code in the new column and copy them to the rest of the rows by pressing twice on the + sign .

woocommerce remove fields from checkout

well it is called “Customizing checkout fields using actions and filters”

what u need to do is to add this code in functions.php and u r done , you need to choose what you want to unset

 
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
  
function custom_override_checkout_fields( $fields ) {
	
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_city']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
unset($fields['billing']['billing_phone']);
unset($fields['order']['order_comments']);
unset($fields['billing']['billing_email']);
unset($fields['account']['account_username']);
unset($fields['account']['account_password']);
unset($fields['account']['account_password-2']);
 
    return $fields;
}

how to add waze link to wordpress

waze is very common and lot request to add link to waze in the footer or contact us to do this u don’t plugins it is very simple link let me explain

first u find your address on google maps : https://www.google.co.il/maps?source=tldsi&hl=en

then from the url we copy the 2 numbers after @ in theis case 32.7142464,35.2547981

https://www.google.co.il/maps/place/Nazareth/@32.7142464,35.2547981,13z/data=!3m1!4b1!4m5!3m4!1s0x151c4e7cf16c0fff:0xd2385b30c1275dd6!8m2!3d32.6996331!4d35.3035355?hl=en

in the footer widget we copy this snippets


<p> <a href="waze://?ll=32.7142464,35.2547981&amp;navigate=yes">
<img src="http://yourdomain.com/wp-content/uploads/2016/05/waze-16.png"></a>
Navigate With-
<a href="waze://?ll=32.7142464,35.2547981&amp;navigate=yes">Waze</a>
</p>

and we change the numbers according to what we copy from google map

p.s here is the waze pic if u need it icon2

Dynamically add a hiden page URL to Gravity Forms

A new site i build lot of forms and i need for one category to have a way to know which post did i get this form from which is known as source of lead in order to do this u need to do this

1. In your forms editor, in the Standard Fields area, find the Hidden field and add it to your form.

hiddenfield

2. Click on the Advanced Tab, and use the Merge Tag dropdown to find “Embed Post/Page Title“. This will let you see what post or page people filled out the form on. If you also want to include the Post/Page URL to make it easy to visit the page from the notification, you can also use the “Embed URL“merge tag.

embedpostpage

3.Also, in the Advanced Tab, make sure to check the box next to “Allow field to be populated dynamically”

4.In the Properties tab, I would recommend using a descriptive title like “Lead came from page:” Since the field is hidden, only you will see this descriptive title.

Here’s how to modify the Notifications to include the new fields you created:

1.Go to Form Settings > Notifications and click on your Admin Notification.

2.Change the Notification Subject to: New submission from {form_title} from Page: {embed_post:post_title}
3.In the Notification itself, you can leave {all_fields} and it will contain the Page Title (and URL if you added it in the Hidden Field).
Now you can test your form and see which pages are generating the most leads. Enjoy!

migrate and transfer Prestashop from localhost to online

my first post in Prestashop and it is on the actual migration after finishing site offline on the localhost

1. Go to localhost directory and find the site directory and make one zip from it so it should be like this sitename.zip

2. Login to your phpMyAdmin on localhost (http://localhost/phpmyadmin/) and choose the right database for the site and press export (Exporting tables from “template” database) i use quick and sql format

3. Create new database on your new domain (newdomain.com) and import sql file that we created pleaes note to UNCHECK this (Allow the interruption of an import in case the script detects it is close to the PHP timeout limit. (This might be a good way to import large files, however it can break transactions.) under Partial Import

4. Edit /config/settings.inc.php on the online folder
There you should update the settings for the new database server (with your own settings instead of the examples here):

define(‘_DB_SERVER_’, ‘localhost’);
define(‘_DB_NAME_’, ‘database_name’);
define(‘_DB_USER_’, ‘database_user’);
define(‘_DB_PASSWD_’, ‘database_pswd’);

5. Upload files from step 2 (sitename.zip) to your new domain (newdomain.com) via FTP or file manager.

6. Remove all the files except index.php in /cache/smarty/compile and /cache/smarty/cache folders on your new domain (newdomain.com)

7. got to phpMyAdmin on the online site and find table shop_url and change domain and domain_ssl to the new domain and the physical_url should be / if no folders is used
The records should be:

domain = example.com
domain_ssl = example.com
physical_url = /

8. Login to your PrestaShop admin panel on new domain (newdomain.com) and check if it is working properly.

p.s when i first uploaded files and extract them on cpanel and loged to site after changing the settings.inc.php i got this error

Link to database cannot be established: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

and the solution was to make the hosting size bigger as i found that the zip that i uploaded was not extracted to the end and lot files was missing that’s it.