Downloads:

HELP & FAQ

Solutions: Prestashop, Odoo, Javascript, Angular, Smarty, PHP, SQL, Ubuntu


Do you need help? Write us an email to: support(at)profistart.com

Prestashop – class product.php

Prestashop Admin Backend Templates

Ubuntu Server Administration - Inotify Example

Javascript jQuery Button hide invisbile hidden field

Prestashop 1.7 layered faceted search frontend display name instead of public_name


Go to following directory:

/modules/ps_facetedsearch/src/Filters/

Open php file:

Block.php

At Line 681 in the sql query change following column

agl.name to agl.public_name

At least login into administration choose faceted search module and click on clear cache on top.

Prestashop 1.6 - Right sorting Products in Category


How solve the Bug false sorted Products in Categories in Prestashop 1.6:

First of all you need following two files: /modules/blocklayered/blocklayered.php and /classes/Tools.php

Put between if and else in blocklayered.php (Line ~2020):


if (version_compare(_PS_VERSION_, '1.6.1', '>=') === true){
		$this->products = Db::getInstance()->executeS('
		SELECT DISTINCT
			p.*,
			'.($alias_where == 'p' ? '' : 'product_shop.*,' ).'
			'.$alias_where.'.id_category_default,
			pl.*,
			image_shop.`id_image` id_image,
			il.legend,
			m.name manufacturer_name,
			'.(Combination::isFeatureActive() ? 'product_attribute_shop.id_product_attribute id_product_attribute,' : '').'
			DATEDIFF('.$alias_where.'.`date_add`, DATE_SUB("'.date('Y-m-d').' 00:00:00", INTERVAL '.(int)$nb_day_new_product.' DAY)) > 0 AS new,
			stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity'.(Combination::isFeatureActive() ? ', product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity' : '').'
				
		FROM '._DB_PREFIX_.'cat_filter_restriction cp
				
		LEFT JOIN `'._DB_PREFIX_.'product` p 
		ON p.`id_product` = cp.`id_product`
				
		'.Shop::addSqlAssociation('product', 'p').
		(Combination::isFeatureActive() ?
				
		' LEFT JOIN `'._DB_PREFIX_.'product_attribute_shop` product_attribute_shop
		ON (p.`id_product` = product_attribute_shop.`id_product` AND product_attribute_shop.`default_on` = 1 AND product_attribute_shop.id_shop='.(int)$context->shop->id.')':'').'
				
		LEFT JOIN '._DB_PREFIX_.'product_lang pl 
		ON (pl.id_product = p.id_product'.Shop::addSqlRestrictionOnLang('pl').' AND pl.id_lang = '.(int)$cookie->id_lang.')
				
		RIGHT JOIN `'._DB_PREFIX_.'category_product` p_cat 
		ON (p.id_product = p_cat.id_product)	
				
		LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop
		ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop='.(int)$context->shop->id.')
					
		LEFT JOIN `'._DB_PREFIX_.'image_lang` il 
		ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$cookie->id_lang.')
				
				LEFT JOIN '._DB_PREFIX_.'manufacturer m 
		ON (m.id_manufacturer = p.id_manufacturer)
		'.Product::sqlStock('p', 0).'

		WHERE '.$alias_where.'.`active` = 1 AND '.$alias_where.'.`visibility` IN ("both", "catalog") AND p_cat.id_category = '.(int)$id_parent.'

		ORDER BY 

		'.Tools::getProductsOrder('by', Tools::getValue('orderby'), true).' '.Tools::getProductsOrder('way', Tools::getValue('orderway')). ' , p.id_product'.
		' LIMIT '.(((int)$this->page - 1) * $n.','.$n), true, false);

		$this->products += Db::getInstance()->executeS('
		SELECT DISTINCT
			p.*,
			'.($alias_where == 'p' ? '' : 'product_shop.*,' ).'
			'.$alias_where.'.id_category_default,
			pl.*,
			image_shop.`id_image` id_image,
			il.legend,
			m.name manufacturer_name,
			'.(Combination::isFeatureActive() ? 'product_attribute_shop.id_product_attribute id_product_attribute,' : '').'
			DATEDIFF('.$alias_where.'.`date_add`, DATE_SUB("'.date('Y-m-d').' 00:00:00", INTERVAL '.(int)$nb_day_new_product.' DAY)) > 0 AS new,
			stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity'.(Combination::isFeatureActive() ? ', product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity' : '').'
				
	FROM '._DB_PREFIX_.'cat_filter_restriction cp
				
	LEFT JOIN `'._DB_PREFIX_.'product` p 
	ON p.`id_product` = cp.`id_product`
				
	'.Shop::addSqlAssociation('product', 'p').
	(Combination::isFeatureActive() ?
				
	' LEFT JOIN `'._DB_PREFIX_.'product_attribute_shop` product_attribute_shop
	ON (p.`id_product` = product_attribute_shop.`id_product` AND product_attribute_shop.`default_on` = 1 AND product_attribute_shop.id_shop='.(int)$context->shop->id.')':'').'
				
	LEFT JOIN '._DB_PREFIX_.'product_lang pl 
	ON (pl.id_product = p.id_product'.Shop::addSqlRestrictionOnLang('pl').' AND pl.id_lang = '.(int)$cookie->id_lang.')
				
	RIGHT JOIN `'._DB_PREFIX_.'category_product` p_cat 
	ON (p.id_product = p_cat.id_product)	
				
	LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop
	ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop='.(int)$context->shop->id.')
					
	LEFT JOIN `'._DB_PREFIX_.'image_lang` il 
	ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$cookie->id_lang.')
				
	LEFT JOIN '._DB_PREFIX_.'manufacturer m 
	ON (m.id_manufacturer = p.id_manufacturer)
	'.Product::sqlStock('p', 0).'

	WHERE '.$alias_where.'.`active` = 1 AND '.$alias_where.'.`visibility` IN ("both", "catalog") AND p_cat.id_category != '.(int)$id_parent.'

	ORDER BY 

	'.Tools::getProductsOrder('by', Tools::getValue('orderby'), true).' '.Tools::getProductsOrder('way', Tools::getValue('orderway')). ' , p.id_product'.
	' LIMIT '.(((int)$this->page - 1) * $n.','.$n), true, false);
}else{

Put following code in "if" instead "$order_by_prefix='cp.';" in Tools.php (Line ~2916):
} elseif ($value == 'position' || empty($value)) {
	$order_by_prefix = 'p_cat.';
	//$order_by_prefix = 'cp.';
}


THAT'S IT! Now your sorting of products in a category is working perfect in Prestashop.

Prestashop 1.7 – change footer.tpl

Prestashop 1.6 BackOffice reduce load times - deactivate module merchant expertise

The merchant expertise module connects to gamification.prestashop.com and often leads to long waiting times in the backend of Prestashop 1.6. Therefore, you can turn off the success indicators in backoffice, to increase the loading speed of your admin area. If you can not log into BackOffice, connect to the Prestashop database, go to the Table ps_module_shop and delete the record gamification module.

Category Navigation Menu - Smarty blockcategories.tpl and category-tree-branch.tpl

Smarty Templates – php smarty array print_r


How check content of an php array in smarty templates?

Push an array in your php-file into smarty template variable like following example.

<?php
$array = array("profi" => "success", "start" => "solution");
$smarty->assign('smarty_template_array',$php_array);

Open your smarty template and print your php array in smarty template for example to control solution.

{$smarty_template_array|print_r}

Open your browser and type in url of your website.

Prestashop Smarty Templates product.tpl - Price display excl. VAT / incl. VAT.


How do I display in Prestashop with VAT or without VAT and gross or net amount?

To show or hide VAT in Prestashop, go to the following Smarty template: /themes/deinTheme/product.tpl (~ Line 300)

{if $priceDisplay >= 0 && $priceDisplay <= 2}
	<span id="our_price_display" class="price" itemprop="price" content="{$productPrice}" style="margin-left:-20px">{convertPrice price=$productPrice|floatval}</span>
	{if $tax_enabled  && ((isset($display_tax_label) && $display_tax_label == 1) || !isset($display_tax_label))}
	<!--	{if $priceDisplay == 1} {l s='tax excl.'}{else} {l s='tax incl.'}{/if} -->
	{/if}
	<meta itemprop="priceCurrency" content="{$currency->iso_code}" />
	{hook h="displayProductPriceBlock" product=$product type="price"}
{/if}

Comment out the IF-conditions for excluding VAT or including VAT text, to hide display VAT completely. In the Prestashop Backend, you can set up under Customers > Groups, who can see gross VAT or net VAT

Prestashop - PDF invoice and Smarty templates


Prestashop PDF invoice templates with Smarty Templates

All Prestashop accounts are located in the / pdf / folder as a Smarty Template File (.tpl) in the root directory. The most important templates for your invoices are /invoice.tpl , /invoice-b2b.tpl . These Smarty templates contain Ordering information such as product, number, price, etc. Other important billing templates are /header.tpl and /footer.tpl . As the name already indicates, this is the head and footing area of ​​the invoice, as the logo address etc. of the company are deposited. The smarty template /invoice-addresses-tab.tpl , which is the customer information, is also important for Prestashop PDF invoices and invoices Of the PDF invoice.

Smarty Templates – SmartyBC vs Smarty Class

Prestashop – Navigation DropDown Menu blockuserinfo nav.tpl


In Prestashop, convert your navigation for the customer area into a dropdown menu

Solution: Open the Smarty Template nav.tpl in the module blockuserinfo from Prestashop. To do this, go to the following folder: /themes/yourTheme/modules/blockuserinfo



Prestashop – admin order mail lang file missing


If you want tosend a mail to your costumer an error occurs language file missing by sending the mail from backend in prestashop.

Solution:

  1. go to /themes/yourtheme/mails/yourlanguage/lang.php
  2. copy the lang.php from step 1 in your root/mails/yourlanguage/

The error occures because the language file is expecting in root/mails, but the language file in prestashop is in /themes/mails/yourlanguage.

Prestashop – Shopping cart button hide or show in smarty template product.tpl


How i can show or hide my shopping cart button when shop is activated?

Open smarty template in folder /themes/meintheme/product.tpl

In Smarty Template goto line ~ 500

<div class="box-cart-bottom">
<div if (!$allow_oosp && $product->quantity <= 0) || !$product->available_for_order || (isset($restricted_country_mode) && $restricted_country_mode) || $PS_CATALOG_MODE} class="unvisible"  /if >
	<p id="add_to_cart" class="buttons_bottom_block no-print">
		<button type="submit" name="Submit" class="exclusive">
			<span> if $content_only && (isset($product->customization_required) && $product->customization_required) l s='Customize' else l s='Add to cart' /if </span>
		</button>
	</p>
</div>
</div> <!-- end box-cart-bottom -->

In the first div-Tag the shopping cart button is hidden or shown by if-condition. Between if-Tag the shopping cart button is visibile or not with class="unvisible"

Here you can leave the if-condition completely or set a new if-condition for your use in prestashop smarty template product.tpl.

Prestashop – Shopping cart change checkout button


How to rename /change/overwrite the text/name in checkout button in prestashop order process?

  1. open smarty template /themes/mytheme/shopping-cart-product-line.tpl
  2. goto end of the smarty template
  3. put following javascript (jquery) code to the end of smarty templage /themes/mytheme/shopping-cart-product-line.tpl
$( document ).ready(function() {
$('.standard-checkout').empty().append(' weiter ');
});

Odoo - EAN-13 Barcode mit Preis


Here the right code to scan an EAN barcode with price correctly without error:

  this.add_barcode_patterns(attributes.patterns || {
                'product':  ['xxxxxxxxxxxxx'],
                'cashier':  ['041xxxxxxxxxx'],
                'client':   ['052xxxxxxxxxx'],
                'weight':   ['31xxxxxNNNDDx'],
                'discount': ['25xxxxxxxNNNx'],
                'price':    ['28xxxxxNNDDDx'],
            });

Prestashop – Attribute Variation Warnings product.tpl / product.js


Smarty Template Path: prestashop/themes/yourtheme/product.tpl – Line ~ 220

Inset new span with id:

{*{l s='Availability:'}*} quantity <= 0 && !$allow_oosp} class="warning_inline"{/if}>

{if $product->quantity <= 0}{if $PS_STOCK_MANAGEMENT && $allow_oosp}{$product->available_later}
{else}
{l s='This product is no longer in stock'}{/if}{elseif $PS_STOCK_MANAGEMENT}{$product->available_now}
{/if}

Javascript Path: prestashop/themes/yourtheme/js/product.js – Line ~ 535

In function findCombination() at the end before calling updateDisplay(), insert following JQuery Code:

//Kombination nicht gefunden
console.log("12. Combination nicht gefunden");
$("#variante_nicht").text("Variante nicht Verfügbar");
$("#variante_nicht").css('display','block');
$('.box-cart-bottom').css('display','none');
updateDisplay();

This position will be called/arrived when no product variation was detected/found from prestashop system. So you can put any code here to display anything when product variation not existing.

Prestashop registration formular authentication.tpl

Prestashop: Last quantity warning product.tpl / product.js:


If the last quantity warning in prestashop doesn’t disappear, only copy the code lines ~ 595 in the function findCombination() in product.js:

function findCombination() { 
	if (!allowBuyWhenOutOfStock){ 
		if (quantityAvailable <= maxQuantityToAllowDisplayOfLastQuantityMessage){ 
			no_var_quantity = 0; 
		}
	}

Create a variable no_var_quantity with default value 2. Set no_var_quantity in the end of function findCombination() to value 1:

no_var_quantity = 1;
updateDisplay(); 
}

Prestashop – Remove Payment Logo Visa Master and Attribute Search in Product Page


How remove Attribute Search in Product Page?

  1. Go into your Themes Folder
  2. Open smarty template product.tpl
  3. Goto Line 347
  4. In div-Tag (id=attributes)
  5. Add style=“display:none“ in the div-Tag

How remove Block Visa Master Payment Logo Picture?

  1. Login Backend
  2. Goto Module
  3. Click on Positions
  4. Disable Block Payment Logo in Hook

Issue: Prestashop Module send to a friend add field

Issue: Prestashop block newsletter


Prestashop Error: lang file is missing

I had this problem, maybe by using own Theme. The language file is missing in prestashop by sending register for newsletter. The confirmation e-mail can't sent out to costumer.

Solution: Put in every following paths your lang.php file. In this example for english language

  • /mails/en/lang.php
  • /yourTheme/mails/en/lang.php
  • /modules/blocknewsletter/mails/en/lang.php
  • /themes/yourTheme/modules/blocknewsletter/mails/en/lang.php

Prestashop - Product not available in this version. Please choose another combination


Product is not available in this version. Please choose another combination.

To work around this warning message, follow these steps:

  • Javascript directory: /themes/default-bootstrap/js/product.js
  • Javascript file: product.js
  • Solution: comment out following lines
  • line: 507 - 510
  • old Code:
    //this combination doesn't exist (not created in back office)
    	selectedCombination['unavailable'] = true;
    	if (typeof(selectedCombination['available_date']) !== 'undefined')
    		delete selectedCombination['available_date'];
    
    	updateDisplay();
  • new Code:
    //this combination doesn't exist (not created in back office)
    	/*
    	selectedCombination['unavailable'] = true;
    	if (typeof(selectedCombination['available_date']) !== 'undefined')
    		delete selectedCombination['available_date'];
    	*/
    
    	updateDisplay();
  • Result: No warning messages - this variant is not available.

Issue: Prestashop imagecreatetruecolor()


Error: The reason of your fatal error in prestashop is: Your php5 doesn't support gd. So install like following:

Solution:

  1. Check your php settings with phpinfo()
  2. Search for gd
  3. sudo apt-get install php5-gd
  4. sudo service apache2 restart

Linux Ubuntu: Apache2 Webserver error.log


Where to find error.log file of apache webserver in Linux Ubuntu?

/var/log/apache2/error.log

JQuery OWL Carousel Responsive


Here the working code for owl carousel responsive and checked. Also you need the free css and js file from owl. Get it at GitHub:
https://github.com/OwlCarousel2/OwlCarousel2/tree/develop/dist

Download following files:
- dist/owl.carousel.min.js
- dist/assets/owl.carousel.min.css

HTML

<div class="wl-carousel">
my Image Link
my Image Link
my Image Link
my Image Link
my Image Link
my Image Link
my Image Link
</div>

JAVASCRIPT

$(document).ready(function() {
var owl =  $('.owl-carousel').owlCarousel({
   itemsCustom : [
        [0, 2],
        [450, 3],
        [680, 4],
        [900, 5],
        [1000, 6],
        [1200, 7],
        [1400, 8],
        [1650, 10]
      ],	
		autoPlay : 5000,
		stopOnHover : true,
		navigation : true,
		navigationText : ["<",">"],
		loop:true,
		center: true,
		autoplay:true,
		autoplayTimeout:1000,
		autoplayHoverPause:true
})
});

Prestashop Images JPG JPEG PNG GIF


Prestashop: Image link in mysql database ps_image and ps_image_shop
In Prestashop all images are linked in the mysql tables ps_image and ps_image_shop. The images are linked with the product in with id_image and id_product. In table ps_image_lang you can get name and descriptions of images.

Prestashop CSV Import


Important points for a right csv import in Prestashop are:

  1. category import
  2. article import
  3. attributes import

Import category by csv file:

  • important is to use category id´s
  • very important is to use category parent id´s for a best structure
  • you can import category by name or id
  • don´t use special characters by csv import in category name

Import article by csv file:

  • important is to use article id´s
  • very important is to name categories where is the article in
  • you can use category id or category name
  • don´t use special characters in article name
  • you can use html tags in description, with enabling the csv import option utf-8

Import attributes by csv file:

  • use article id´s for get the right article
  • the order of attribute names and attribute value is not important
  • only specify order like :0,...:1,...:2 equal in both columns (attribute name, attribute value)
  • you can´t use range controller for attributes, only for price and weight

Prestashop AdminTab add Module


The easiest way is the best way. Don`t forget your skills like developer and keep line in your object programing know how. So you can integrate your prestashop module into the prestashop backend menue bar on left site.

After some tries and looking in blogs, here your simpliest solution:

//get prestashop admintab class
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); 

//get your module class
include_once(PS_ADMIN_DIR.'/../modules/produkt/produkt.php'); 

/*extend the admintab and put in in the folder 
/admin/tabs/AdminProdukt.php*/

class AdminProdukt extends AdminTab 
{

private $asp=NULL; //safety first

public function __construct()
{
	//your module class
	$this->asp = new Produkt(); 
	//call AdminTab parent constructor
	parent::__construct(); 
}
	
public function display()
{
	//best way to get function of your module class
	echo $this->asp->getContent();
} 
}

XDebug Eclipse Mars PHP


How remote debugging with xdebug and eclipse mars web application, php files?

  1. Download xampp with apache and mysql
  2. Configure php.ini like following:
    [XDebug]
    xdebug.remote_enable=true
    xdebug.remote_host=127.0.0.1
    xdebug.remote_port=9000
  3. Restart Webservice (xampp)
  4. Goto xdebug page and copy your source code in the text area and follow given steps: https://xdebug.org/wizard.php
  5. Open Eclipse Mars
  6. Goto Register Run - Debug Configurations

    a. Create new PHP Web Application

    b. Register Server - Default PHP Web Server - File - your PHP Project

    c. Debugger - Configure - Debugger - XDebug - Port 9000

  7. Open Google Chrome Browser Install Free XDebug Addon for Google Chrome Now you can see a Bug Icon on top-right corner like picture

  8. Enable XDebug via Icon

  9. Goto Eclipse set breakpoints on left border via double click and start debugging step by step

  10. Have fun with debugging and coding!

Second Server: Start Remote PHP SQL Query


For me the simplest solution for this issue / problem is using PHP function file_get_contents()
To prevent a lot of problem create a file on the server with mysql database.

Write some select, insert or update queries in normal mysqli-connect and mysqli-query

("SELECT * FROM testtab WHERE testcol = 'yours'") or mysqli-query("INSERT INTO testtab...)

Print out the query with print_r() or echo.
Create a new file on other server where you like print out the queries.

Use the PHP function file_get_contents
('the path of the query file') and get the string of all print_r() or echos from the query file into your new file.

You need also the PHP functions utf8_decode() and utf8_encode() for special characters.

Smarty Templates Example


I need some content in my blog, so here a easy example for smarty templates using. Before you start with smarty templates please visit the homepage of smarty to learn something about the smarty framework / engine: http://www.smarty.net/

HTML:
<DIV CLASS=“ONEDIV“>{$MYVARIABLE}</DIV>

<DIV CLASS=“ANOTHERDIV“>

{IF $CHOOSE EQ ‚FIRST‘}

<DIV CLASS=“INSIDEDIVONE“>HELLO</DIV>

{ELSEIF $CHOOSE EQ ’SECOND‘}

<DIV CLASS=“INSIDEDIVTWO“>HOW ARE YOU?</DIV>

{ELSE}

<DIV CLASS=“INSIDEDIVTHREE“>NO</DIV>

{\IF}

</DIV>
PHP:
$MYVARIABLE = ‚A SIMPLE SHORT EXAMPLE FOR SMARTY ENGINE‘,

$CHOOSE = ‚FIRST‘;

Joomla 2.5.14 move to 1und1


After I moved the website for a customer based on Joomla 2.5.14 on a 1und1 server, I will not deny you the problem solutions. I have two hours on various help pages and forums looked up, the error when calling the page ...

"The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request."

Best tips and solutions in short:
  • edit php.ini: put "allow_url_fopen" to "on" (insert row: allow_url_fopen=on)
  • configuration.php bearbeiten: ganz wichtig - hier Datenbankeinstellungen und Pfade anpassen!
  • edit .htaccess: deactivate or insert the following entries:

    AddType x-mapp-php5.php
    AddHandler x-mapp-php5.php
  • Edit user and group rights: All access rights to folders and files can not be assigned on the Internet
  • Solution:

    Get following Google Chrome Addon from https://chrome.google.com/webstore/detail/web-developer-joomla/kccpfcmcfhpdgkeadjmdkgjbebphnemk?hl=en
    So I could reach more than just the homepage of Joomla. I have logged in and am then under "configuration" in the tab "Sites" under "Search engine optimization" the "Use URL rewrite" to "No". That's it!

    Another tip! If you are already on the Joomla configuration since, show version to "YES", so you can save time next time.

php - header()


Important information for develop starter: Sending header() information reloads the page because of php functionality - server response and request. If you working with javascript, this is only onpage without communication between server and client. If you need new page and a communication to server, so you need to handle this with php. If you only change content in the same page, you can use javascript - only client site or only server site.

Getting started Angular 2

Javascript Angular 2 client- and server-side web applications


Secure web applications with user authentication OAuth 2.0 and authorization structures with Angular 2 routing

Important is the user authorization, as Backend Services has to handle more and more javascript frontend applications. This all are realized by a token system. The OpenID Connect application is a useful tool. With Angular 2 Routing authorized users are directed to authorized views.

JWT - JSON Web Token is an effective and standardized format according to RFC 7519 to implement a token distribution system.

Javascript Node.js Framework Express is a great tool for file upload, authentication, and log files. Express is a module of Node.js for Routing. In principle, when an Express application is used, certain functions are specified by URL path and HTTP method to generate a response to the client.

Angular - get scope from other controller


How get $scope from other controller in angular.
The simpliest way is every time the best. If you have two or more controller and you like update the scope of one controller with another controller, you need a parent child structure, else you can't update the scope of other controller. Another way to share Service in Angular is the factory method. Back to parent child structure in angular. If one controller is the parent controller, so you can simply change the scope of parent controller with the child controller like following:

Javascript Angular:

//instead of
$scope.variable = data;

//write
$scope.$parent.variable = data;
<div ng-controller="ParentCtrl"> 
<div ng-controller="ChildCtrl"></div> 
</div>

How get list of E-Mail address from cleverreach


//apiKey look in your cleverreach
$apiKey = "b#797###e8f6###25#########40d63#-#"; 

$wsdl_url="http://api.cleverreach.com/soap/
interface_v5.1.php?wsdl";

//listId look in your cleverreach
$listId = "1####8"; 

$api = new SoapClient($wsdl_url);


$page = 0;

do{
    $filter = array( "page"=>$page++,
        "filter"=>"all"  //active, inactive, bounce
    );
    $return = $api->receiverGetPage($apiKey, $listId, 
    $filter);
    if($return->status=="SUCCESS") {
        for($i=0;$i < count($return->data);$i++){
            var_dump($return->data[$i]->email); 
        }
    }else{
        //var_dump($return->message);
    }
}while($return->data);

Postgresql Timestamp


For getting time difference in postgres Timestamp Format

SELECT "Timestamp", "column", "column"

FROM "Database"."Table"

WHERE "Timestamp" > CURRENT_TIMESTAMP - INTERVAL '20 hours'

ORDER BY "Timestamp"

DESC

c3 Charts javascript config width


Change width of javascript c3.js charts, please insert following method for c3Config in javascript

var c3Config  =  {

size: {

 width: <em>mywidth</em> },
...
}

Javascript Luhn Algorithm

Html Javascript and JQuery


The wheel does not have to be invented twice. JQuery in Javascript provides many features to build a modern page.


$(document).ready(function(){
$('div').show();
});

Javascript promise, async function and await

Prestashop TinyMCE editor break instead of paragraph by pressing enter


How to change TinyMCE editor configuration in Prestashop for making breaks instead of paragraphs by pressing enter

Insert following configuration in /js/admin/tinymce.inc.js
forced_root_block : false,
force_p_newlines : false,
force_br_newlines : true,