profistart e-commerce blog

Do you need help in Prestashop, Odoo, Javascript, Angular, Smarty, PHP, Mysql or Postgres databases?

profistart E-Business Professional


Write us an E-Mail: support(at)profistart.com
We will post the Solution here by profistart Blog

PROFISTART JAVASCRIPT | JS NEWS


  • Laravel 5.7 Release PHP Framework Laravel 5.7 Release is open-source and very popular for developing web applications. Lavarel have MVC architecture and uses Symfony. Laravel have a userfriendly administration and a good dashboard for developers. Laravel have array calls for URL generation. Also you can improve errors with scoping. In conclusion Laravel is a good tool for developing in PHP.

  • Node.js 10 Release What is new?

    • OpenSSL 1.1.0 support
    • stable Node.js API for easy upgrades
    • Bugfix string functionalities
    • Error handling improvements
    • Trace events

  • Webpack 4 release Webpack 4 offers with new version a lot of new features. Webpack 4 is 40% faster. Bugs in plugins been fixed. The CommonsChunkPlugin was replaced by optimzation.splitChunks which much mor flexible.

  • Bootstrap 4.0 Release The popular open source css styling framework Bootstrap released Bootstrap 4.0 with new features. The core developer team fixed bugs, optimized framework and expanded documentation. The Normalize.css for rendering html elements was connected with the Bootstrap Reboot for a better workflow. Bootstrap 4.0 supports IE10 and iOS7. For IE8, IE9 and iOS6 Boostrap 3 is required. Also Flexbox, form and Grid System is improved for a more flexible design possibility.

  • Node.js framework NestJS NestJS is a server-side framework for supporting developers. NestJS offers Microservices architecture, Driven Design and Event Sourcing. NestJS framework is lightweigt and developers can use whole framework or some components of it. NestJS is written in TypeScript and supports Dependency Injection Container, Factory Injection, Modularity and Testability.

  • Ember.js front-end library GlimmerJs for mobile Application GlimmerJs UI component library offers a virtual machine for run application inside web browser. GlimmerJs have templates and a rendering engine. One of new features of GlimmerJs is compiling templates in JSON format.

  • Nginx Plus 12 with NginScript similar Javascript NginScript can be used for programming actions in HTTP, TCP and UDP. NginScript offers additional math methods, string methods and constants. Nginx Plus 12 configuration can be push from master Server to peers. User traffic can be switch to next server via load-balancing check. The R12 manages cache refreshes automatically. Also Nginx Plus 12 offers monitoring of many activities like application performance, response time and memory capacity.

  • Nectar.js compiles Javascript into native binaries, compatible for all platform Vision of Nectar.js is making Javascript universal for every platform. Javascript working on a lot of platform. Nectar.js want unify all solutions in one code that working on all platform.

  • Multi-threaded server-side Javascript run-time Nexus.js Nexus.js can be compared with Node.js. Nexus.js have no event loop. All events are scheduled in a thread pool, which are executed on all available CPU cores like tasks in windows depending on priority.

  • Rollbar is powerwful error monitoring in Javascript Rollbar is quickly and easy to start. Rollbar supports React, Angular, Node, Ember, Backbone, Vue, Meteor etc. Rollbar get error in real-time which are grouped by root cause with detailed stack trace and request variables. Rollbar allows debugging and detecting errors and much more options to debug your javascript code.

  • Odoo install: Python & Flask - app.route() & render_template() The well-known ERP system Odoo is based on the programming language Python instead of PHP. PHP is the programming language for web applications and server-client communication. Benefits of Python include the very simple programming language syntax. Python can be developed web applications and Desktop applications with user interfaces for Windows or Linux. Python together with the Flask Framework allows the routing and integration of templates, similar to the Template Engine Smarty Templates. Via app.route() content, functions and templates are assigned to a specific URL. render_template() will insert a template in .html format. The only obvious drawback is that Python needs a set up and needs to be adjusted before running. In contrast, PHP and Appache is standard and ready for use on most servers and operating systems with one click.

  • Javascript Debugging Tips

    • Standard: console.log();
    • Table for arrays: console.table(array);
    • Check executing time for a function: console.time('TimerA'); function(myfunction) console.timeEnd('TimerA')
    • Trace function for see which function executed: console.trace('TraceA');

    Google Chrome Explorer offers a lot of more functionalities for debugging Javascript code. For example, unminify minified code or debug special function function.

  • Javascript Framework React v16.0 release. A new version of Javascript React v16.0 has been released. The popular Javascript framework brings new rendering and debugging types in the new version, improved error handling, better DOM management, which also recognizes SVG elements and the new extended version of React is smaller than its predecessor.

  • Garbage Collection with JavaScript. Javascript also uses the garbage collection to manage memory automatically. So the garbage collector is a tool for managing necessary and unnecessary memory to minimize memory size. Unnecessary memory gets deleted and memory space is freed up with garbage collector.

  • JavaScript new package manager yarn. Most popular package manager for javascript is npm, which manage 350000 packages in npm registry, used by 5 million engineers and downloaded 5 billion times every month. By looking for solutions for more security, more performance and less consistency problems, the new alternative package manager yarn was born. Yarn is fast, reliable and secure. Yarn have access to npm packages and focus on building new software products and features. Yarn caches every package. Yarn uses checksum to verfiy package. Yarn uses a lockfile format and algorithm for install that worked on every system in the same way.

  • JavaScript and new TypeScript are the languages of web. Javascript is the super controller of web elements which orders from top as monopol. Typescript is the connection which communicate with all elements and languages. For example Angular was written in Typescript. Typescript get popularity in a very short time. Typescript connect more than 20 languages, for example Javascript and Java.

  • Javascript Gulp.js simpliest way to develope. The minimal API surface of Gulp.js makes it easy to use. Gulp.js builds efficient and fast without writing files to hard disk. Gulp.js gives you a high quality environment that works simple and as required.

  • Javascript Apps Meteor.js Meteor.js allows developer code in 10 lines which take 1000 lines. This is possible with Meteor.js and integrated JavaScript stack. With Meteor.js you build applications automatically for all devices like Android, iOS or desktop. The Meteor.js framework let you focus on features instead of handling with components.

  • Moon.js inspired by Vue.js Moon.js is a lightweight, fast and intiuitive Javascript library. Moon.js weighs 5kb. Moon.js uses fast virtual DOM and can update DOM elements without reload page similar other MVC frameworks. Moon.js combines the positive properties of popular libraries and framework for building user interfaces. Moon is the fastes user interface library today.

  • Microservice for front-end web development. Actually front-end development becoming more and more important with Javascript Frameworks. Because it is faster and not resource intensive for server like back-end functionalities. In future the keyword is micro frontends which makes front-end developing more structured with shared cores, seperated modules and framework for complete software like cloud system.

  • Node.js async function. Until now async functions are available in other programming languages like Kotlin, C# or Go. The execution of async functions can be halted and return a Promise object instead of boolean or value. You can catch any Promise or the rejection of Promise in a async function now in Javascript Node.js

  • Coming Javascript with TC39 and ECMAScript. TC39 is a part of ECMA and means Technical Committe number 39. TC39 is the standard for Javascript Code under ECMAScript protocol. ECMAScript handles string convention, defintions and validation of javascript language.

  • Express.js for Javascript Node.js Express.js is minimum made of an app.js file with program and controller to start a web server. Express.js provides each HTTP request with several routing tools that are executed successively. A logical sequence is the request query, the request response and the next request to be processed. Express.js is mainly used together with MongoDB, NoSQL, Angular.js and Node.js.

  • Create Rich Text Editor with Draft.js Javascript Draft.js is a strong framework for program a Text Editor. Draft.js is much more easy for working with editable content. Draft.js is based on Javascript react.js and immutable.js frameworks.

  • CheerpJ compile Java bytecode and convert into Javascript CheerpJ convert Java into Javascript without Java source code. Server side Java components become client side browser based Javascript. CheerpJ release pis planned on July, also the CheerpL Applet Viewer Chrome extension.

  • ReactJS a free Javascript library for building user interfaces. React.js provides single-page applications or variants of interactive views. React.js started by facebook developer. React keeps control of DOM, updates and renders right components with own states.

  • Total.js free alternative to Slack. A independent team messenger on own server, well served with Javascript OpenSource Framework Total.js. Real-time chat with file attachment, emojis and more. However, Total.js compare to the commercial competitor Slack, Total.js is more slim.

  • New TypeScript 2.4 popular framework of Javascript offers dynamic import of parameters and improved load times. TypeScript 2.4 also offers modular coding with smaller bundles of code and more safety by checking callback parameter.

  • Javascript difference between undefined and null. Undefined means, a variable is declared but the value not defined. Undefined is type of undefined. The object null stands for non-existent or empty value. Null is a assigned value.

  • Javascript console object part of window object helps you output strings, array and objects for debugging code. Most common object of console is object window.console.log. We have have 3 other objects like info, warn and error for doing this job.

  • Javascript design pattern currying with default params. Currying is a strong framework for functional programming. Javascript currying is programming modular and sequential. Javascript currying is splitting a function of multiple arguments into sequential called functions for one argument.

  • Javascript Node.js framework Mocha. Mocha is a test framework in javascript running on Node.js. With Mocha you are able to test asynchronous and serially for proper and flexible reporting. With Mocha you can map uncaught exceptions to the correct test cases.

  • Javascript library Preact.js offers fast 3kb with ES6 API. Preact.js is a alternative to React.js. Preact has more than 12.500 stars on GitHub. Preact is lightweight and developer work with very fast and easy to build JavaScript web applications.

  • Manage billions of information with Node.js and MySQL. Simple and fast with good planing and indexing MySQL databases. Many partitions and tables to manage a lot of data. A good alternative is NoSQL. Use Node.js Monitoring and Debugging Tool for tracing data.

  • WebStorm IDE Javascript Development Environment is very useful for advanced Javascript development. Everyone who is looking for javascript debugging tool, WebStorm is a good solution for Javascript similar to PHPStorm for PHP. You can also debug and handle css stylesheets and known javascript frameworks like Angular, React, Vue.js, Node.js, Meteor and Electron with WebStorm.

  • Node.js Monitoring Tool for developers to check traces and debug Node.js frameworks. With new Node.js Monitoring Tool you comprehend Node.js operations, avoid downtimes and discover infrastructure.

  • Node.js 8 Release. Most important improvements of Node.js 8 are the N-API which allows native add-ons to run by all Node.js versions and the Asysnc Hooks API which inform user about all active objects in Node.js. Another feature of Node.js 8 is the zero filled buffering to protect senitive informations.

  • Javascript Framework EmberJS 2 for easy building web applications. The Javascript MVC Framework EmberJS 2 is similar to Angular, Laravel, Rails or other MVC frameworks, but easier in routing, handling templates, managing models, components and controlling.

  • Javascript Framework npm v5.0.0 release. The CLI Team released npm 5 with a lot of improvements in performance, error handling and fault-tolerance. The biggest changes were done for the installer and cache.

  • Serverless coding with AWS Lambda and Javascript Framework Node.js. Programming without worry about it-infrastructure. Concentration only on the application functionalities. Since launching AWS Lambda 2014, serverless coding with Node.js is popular. Cloud providers started launching own serverless. For example Google Cloud Functions, IBM OpenWhisk or Microsoft Azure Functions.

  • Load Balancing with Node.js in NGINX and Docker: Make a part of software packaged in isolated containers. To getting work your software you only need the libraries. The software architecture working in containers. They are dockerize. So no full operation system doesn't need any more.

  • New JSON Feed is a format like RSS or Atom. It is more compact than XML. JSON Feed for better reading and writing feeds and less risk for bugs.

  • Electron Development is faster, low cost and modern for developing desktop apps for Linux, Windows and Mac. Electron based on Node.js and is like coding for web application with it's all DOM API's, Javascript, HTML5, CSS.

  • Javascript Framework D3.js Britecharts is a easy and fast way to create nice visual charts. D3.js Britecharts are reusable and bug free. All components are used with basic methods for legend chart, line chart, bar chart, brush chart, donut chart, sparkline chart, step chart, stacked area chart.

  • The smart JQuery Plugin Sticky Sidebar supports several sidebars in one and is compatible with IE9 +, Firefox, Chrome and Safari. Sticky Sidebar is responsive and automatically adjusts to the screen size. Try out the advantages of the JQuery Sticky Sidebar Plugin!

Ubuntu Server Administration - Inotify Example


Monitor folder and write in file with timestamp in ubuntu server with inotify. Simply way to monitor and write in file in following code:

  • Install inotify
  • Start inotifywait
  • Description
sudo apt-get install inotify-tools

After installing inotify write in ubuntu terminal following inotify code:

inotifywait -mr -e modify -e delete --format %T%W%f_%e --timefmt "%d/%m/%X_%H:%M" <folderpath> >> <filename_with_path>

Description: Events and options for inotify:

  • inotifywait starts inotify
  • -m starts inotify after event again
  • -r monitor all files and folders recursive
  • -e modify monitor all modifications
  • -e delete monitor all delete events
  • --format format output style
  • --timefmt format time
  • > write in new file
  • >> write in same file (e.g. /root/check_folder.log)

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.

Javascript jQuery Button hide invisbile hidden field


Javascript jQuery Button show hidden div- span- or p- tag

How to hide and show a container with javascript jquery framework?

Get startet jQuery:
Put in your html header:

<head><script> src="jquery-3.2.0.min.js"> </script></head>

Put in your html body:

<div class='myfield'>Hallo, you pressed the button.</div> <button class='mybutton'>Button</button>

Put in your html to the end of your body:

$( function() { $( ".myfield" ).hide(); $( ".mybutton" ).click( function() { $( ".mybutton" ).show(); } ); } );

Another solution:

$( function() { $( ".mybutton" ).click( function() { $( ".mybutton" ).toggle(); } ); } );

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


How to change the smarty template footer.tpl in Presashop 1.7?

Open folder /themes/classic/templates/_partial/footer.tpl
For example in line 57 and 59 change prestashop link to normal text by replace a-href tags to div tags.

<div class="container"> <div class="row"> {block name='hook_footer_before'} {hook h='displayFooterBefore'} {/block} </div> </div> <div class="footer-container"> <div class="container"> <div class="row"> {block name='hook_footer'} {hook h='displayFooter'} {/block} </div> <div class="row"> {block name='hook_footer_after'} {hook h='displayFooterAfter'} {/block} </div> <div class="row"> <div class="col-md-12"> <p> {block name='copyright_link'} <div> {l s='%copyright% %year% - Ecommerce software by %prestashop%' sprintf=['%prestashop%' => 'PrestaShop™', '%year%' => 'Y'|date, '%copyright%' => '©'] d='Shop.Theme'} </div> {/block} </p> </div> </div> </div> </div>

Prestashop – class product.php


Prestashop product, product quantity, combinations, attributes, variations

In folder classes look for product.php
Goto line with following code: Here Prestashop checking if combination is set and have a minimum quantity

if (!isset($combinations[$id_product])) $combinations[$id_product] = array(); if (isset($combinations[$id_product][$minimum_quantity])) return $combinations[$id_product][$minimum_quantity];

Prestashop selects from mysql database the product attributes where quantity matching conditions

$sql = 'SELECT product_attribute_shop.id_product_attribute FROM '._DB_PREFIX_.'product_attribute pa '.Shop::addSqlAssociation('product_attribute', 'pa').' '.($minimum_quantity > 0 ? Product::sqlStock('pa', 'pa') : ''). ' WHERE product_attribute_shop.default_on = 1 ' .($minimum_quantity > 0 ? ' AND IFNULL(stock.quantity, 0) >= '.(int)$minimum_quantity : ''). ' AND pa.id_product = '.(int)$id_product; $result = Db::getInstance()->getValue($sql); $combinations[$id_product][$minimum_quantity] = $result; return $result;

Prestashop Admin Backend Templates


Where are the smarty templates for prestashop admin templates, prestashop backend templates?

The smarty templates for prestashop admin backend are in /admin/themes/default/template/controllers/products/
There can you find all templates of prestashop admin backend:

  • assosciations.tpl
  • attachments.tpl
  • combinations.tpl
  • customization.tpl
  • features.tpl
  • images.tpl
  • informations.tpl
  • pack.tpl
  • prices.tpl
  • quantities.tpl
  • seo.tpl
  • shipping.tpl
  • suppliers.tpl
  • virtualproduct.tpl
  • warehouse.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


Prestashop Category Navigation show / hide the menu items

Solution: Open in Prestashop in /themes/modules/blockcategories the Smarty Template blockcategories.tpl and insert in blockcategories.tpl following Javascript (JQuery) Code:

<script> $(document).ready(function() { var tg_cats = window.location.pathname.substring(1); if(tg_cats == "1005-kategoriename-profistart"){ $( ".grower" ).removeClass( "CLOSE" ); $( ".grower" ).addClass( "OPEN" ); $( ".tg_geoeffnet" ).show(); }else{ $( ".grower" ).removeClass( "OPEN" ); $( ".grower" ).addClass( "CLOSE" ); $( ".tg_geoeffnet" ).hide(); } }); </script>

Step: Open in Prestashop in /themes/modules/blockcategories the Smarty Template category-tree-branch.tpl and complement in Line 33 the ul-Tag with following Class.

... <ul class="tg_geoeffnet"> ...

Description: The javascript code reads the current URL of your web page and the category name is matched using JQuery. If the category name is true, JQuery automatically opens the hidden menu items in the navigation.

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


The basic difference between the SmartyBC and Smarty class is:

SmartyBC is backward compatible and supports PHP commands within {php} {/php} Tags in the Smarty Template.

<?php //Call Smarty Class require_once('path/to/smarty/libs/Smarty.class.php'); $smarty = new Smarty(); //Call SmartyBC Class require_once('path/to/smarty/libs/SmartyBC.class.php'); $smarty = new SmartyBC(); ?> //In Smarty Template for example smarty_template.tpl run PHP code {php} echo "Here is PHP"; print_r("Here is PHP print_r() Function."); var_dump("Here is PHP var_dump() Function."); {/php}

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

Replace line 7 to 17:

<div class="header_user_info"> {if $is_logged} <a class="logout" href="{$link->getPageLink('index', true, NULL, "mylogout")|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Log me out' mod='blockuserinfo'}"> {l s='Sign out' mod='blockuserinfo'} </a> {else} <a class="login" href="{$link->getPageLink('my-account', true)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Log in to your customer account' mod='blockuserinfo'}"> {l s='Sign in' mod='blockuserinfo'} </a> {/if} </div>

By following Code:

<div class="header_user_info"> {if $is_logged} <div class="dropdown dropdown_after_before"> <a class="account" data-toggle="dropdown" href="#"><span class="wdt_li"><i class="icon-user"></i></span><span> {$cookie->customer_firstname} {$cookie->customer_lastname}</span></a> <ul class="dropdown-menu toggle_ddm" role="menu"> <li><a href="{$link->getPageLink('my-account', true)|escape:'html':'UTF-8'}" title="{l s='View my account' mod='blockuserinfo'}"><div class="wdt_li"><i class="icon-suitcase"></i></div> <div>{l s='Account' mod='blockuserinfo'}</div></a></li> <li><a href="{$link->getPageLink('history', true)|escape:'html':'UTF-8'}" title="{l s='Orders' mod='blockuserinfo'}"><div class="wdt_li"><i class="icon-list-ol"></i></div> <div>{l s='Orders' mod='blockuserinfo'}</div></a></li> <li><a href="{$link->getPageLink('addresses', true)|escape:'html':'UTF-8'}" title="{l s='Addresses' mod='blockuserinfo'}"><div class="wdt_li"><i class="icon-map-marker"></i></div> <div>{l s='Addresses' mod='blockuserinfo'}</div></a></li> <li><a href="{$link->getPageLink('identity', true)|escape:'html':'UTF-8'}" title="{l s='Information' mod='blockuserinfo'}"><div class="wdt_li"><i class="icon-info"></i></div> <div>{l s='Personal info' mod='blockuserinfo'}</div></a></li> <li><a href="{$link->getModuleLink('favoriteproducts', 'account', [], true)|escape:'html':'UTF-8'}" title="{l s='My favorite products.' mod='favoriteproducts'}"><div class="wdt_li"><i class="icon-star"></i></div> <div>{l s='Favoriten' mod='favoriteproducts'}</div></a></li> {capture assign="HOOK_USER_INFO"}{hook h="displayUserInfo"}{/capture} {if !empty($HOOK_USER_INFO)}{$HOOK_USER_INFO}{/if} <li class="divider style="background-color:#D3D3D3;">Tahsin Goekokus</li><li><a class="logout" href="{$link->getPageLink('index', true, NULL, "mylogout")|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Log me out' mod='blockuserinfo'}"><div class="wdt_li"><i class="icon-sign-out"></i></div> <div>{l s='Sign out' mod='blockuserinfo'}</div></a></li> </ul> </div> {else} <a class="login" href="{$link->getPageLink('my-account', true)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Log in to your customer account' mod='blockuserinfo'}"> {l s='Sign in' mod='blockuserinfo'} </a> {/if} </div>

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?

Lösung: 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


How to set up required fields in prestashop authentication?

Open the php-file Address.php in folder classes (Line 107 - 134):

public static $definition = array( 'table' => 'address', 'primary' => 'id_address', 'fields' => array( 'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_supplier' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_warehouse' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_country' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_state' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId'), 'alias' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32), 'company' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 64), 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), 'vat_number' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true,'size' => 50), 'address1' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'required' => true, 'size' => 128), 'address2' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'size' => 128), 'postcode' => array('type' => self::TYPE_STRING, 'validate' => 'isPostCode', 'size' => 12), 'city' => array('type' => self::TYPE_STRING, 'validate' => 'isCityName', 'required' => true, 'size' => 64), 'other' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'size' => 300), 'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32), 'phone_mobile' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32), 'dni' => array('type' => self::TYPE_STRING, 'validate' => 'isDniLite', 'size' => 16), 'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false), 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false), ), );

Here are the fields from registration formular defined by typ, size and required field. For example the field vat_number in authentication is set as required field with "'required' => true".

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 sent to a friend add field


Add a Comment input text field or textarea in smarty template /themes/mytheme/modules/sendtoafriend/sendtoafriend-extra.tpl (Line 64)

<p class="text"> <[label for="friend_comment"> {l s='Friend Comment' mod='sendtoafriend'}]> <[/label]> <[input id="friend_comment" name="friend_comment" type="text" value=""]> </p>

Get your id value in javascript in /themes /mytheme /js /modules /sendtoafriend /sendtoafriend.js (Line 40)

var name = $('#friend_name').val(); var email = $('#friend_email').val(); var stf_comment = $('#friend_comment').val();

Put your value into ajax post function (Line 54)

$.ajax({ url: baseDir + 'modules/sendtoafriend/sendtoafriend_ajax.php?rand=' + new Date().getTime(), type: "POST", headers: {"cache-control": "no-cache"}, data: { action: 'sendToMyFriend', secure_key: stf_secure_key, name: name, email: email, id_product: id_product, stf_comment: stf_comment }

Now go to file /modules/sentoafriend/sendtoafriend_ajax.php (Line 50)

foreach ($friend as $key => $value) { if ($value['key'] == 'friend_name') $friendName = $value['value']; elseif ($value['key'] == 'friend_email') $friendMail = $value['value']; elseif ($value['key'] == 'id_product') $id_product = $value['value']; elseif ($value['key'] == 'friend_comment') $friendComment = $value['value']; } } else { $friendName = Tools::getValue('name'); $friendMail = Tools::getValue('email'); $id_product = Tools::getValue('id_product'); $friendComment = Tools::getValue('stf_comment'); }

(Line 77)

$templateVars = array( '{product}' => $product->name, '{product_link}' => $productLink, '{customer}' => $customer, '{name}' => Tools::safeOutput($friendName), '{friend_comment}' => Tools::safeOutput($friendComment) );

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();
  • neuer 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

Issue: Prestashop product save button


Prestashop Issue: Error: Adding and saving product attributes doesn't work in prestashop

Adding attributes to product and saving, changes are not updated. Sometimes it is saving sometimes not without error message. Solution:

https://www.prestashop.com/forums/topic/442145-cant-add-new-product-attributes/

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 <em>div class : owl-carousel my Image Link my Image Link my Image Link my Image Link my Image Link my Image Link my Image Link div </em> >>>JAVASCRIPT <em>$(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 }) });</em>

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> </HTML><PHP> $MYVARIABLE = ‚A SIMPLE SHORT EXAMPLE FOR SMARTY ENGINE‘, $CHOOSE = ‚FIRST‘; </PHP>

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


Angular 2 Model:

NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, FormsModule, HttpModule ], providers: [] }) export class AppModule { }

Angular 2 Component:

Component({ template : `<div>Welcome to profistart Angular for Beginner</div>` })

Angular 2 init Model:

platformBrowserDynamic().bootstrapModule(AppModule);

Angular 2 init Event Listener:

Component({ selector: 'profistart-root', template: `<textfield (keyup)="onKeyUp()" (textfield)="color=$event.target.value" [style.background-color]="color">` }) export class AppComponent { public color: string; onKeyUp() { console.log('keyup: ' + this.color) } }

Angular 2 Directive:

Component({ selector: 'profistart-root', template : `<textfield´ [(ngModel)]="content" > <p>content</p>` }) export class AppComponent {}

Angular 2 Connect Model View:

Component({ selector: 'profistart-root', template: `<span>Hallo i am a component</span>` })

Angular 2 Selector:

<div class="container"> <profistart-root> </profistart-root> </div>

More Examples: stackoverflow.com/questions/38103920/how-to-use-javascript-functions-in-an-angular-2-component-from-a-different-file

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;
$scope.$parent.variable = data;

<div ng-controller="ParentCtrl"> <div ng-controller="ChildCtrl"></div> </div>

Microsoft Windows rundll32.exe


Today i had a Problem with my Microsoft Windows 7 System. The Task rundll32.exe used min. 50% of my CPU. So i started checking out the reason of this anormal difference to the past. Fast and quickly by Task Manager i found the reason: rundll32.exe

Some user in the Internet had the same Problem. It seems Microsoft is collecting data from Windows user. Since Windows 10 officially. For me it is not a Problem for my private Computer at home. But its a Problem when i can't use the System because it was used to submit data to Microsoft.

The simple solution for my issue was, check out updates from Microsoft and deinstall the Update KB2952664. More Information in german you get here: http://www.winfuture-forum.de/index.php?showtopic=210145.

Windows 10


Since July 29, Windows 10 has been available to the market for everyone. Also, there are Microsoft's hard-working updates and lots of small bug fixes. Already 60 million users already use the new operating system from Microsoft.

Damit Windows 10 richtig durchstarten kann, stellt Microsoft für viele Benutzer das Betriebssystem als kostenloses Update zur Verfügung.

In order for Windows 10 to run properly, Microsoft provides the operating system as a free update for many users.

Our conclusion: After the gossip with Windows 8 for Microsoft, it can only go uphill with Windows 10. The characters for Microsoft are good.

phpStorm SVN Subversion Control Branches


Simply branching via phpStorm svn:

With phpStorm Subversion Control you can simply create in svn a parallel copy of your project.

Update your project copy from main project which is the original working project.

After svn update you have the newest version (the acutal svn version) from the original project.

Work with your project, the copy of original. When you finished your development, merge your

project to original project. Thats all.

VCS - Subversion - Update Directory...
VCS - Subversion - Update File...

One important issue is: when updating checked the checkbox!

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" &gt; 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> }, ... }

Microsoft Internet Explorer changes name


Microsoft will change the name of Internet Explorer. Maybe the reason is a image of Internet explorer which Microsoft like to push. Another reason can be a new Explorer completely different as  old Internet Explorer. More Information about the new name and reason coming soon...

Smarty Templates


When you need a simple easy to understand / learn or fast start content management system, look for Smarty Template its very smart!

Look at - http://www.smarty.net

Angular MVC


Angular for better, more compact and serviceable javascript source code
MVC separates  Model and Controller, so you can change the Model without changing the Controller or the Controller without changing the model. Angular offers more features. One of the new Angular feature is refreshing page in realtime without pushing a button. For example users can change the website view directly by Formular.

Cache your database is the way


More Postgres, MySql performance
For more Postgres, MySql performance is a good caching the best way to speed up your requests in application. Postgres, MySql, Oracle you need every time a good caching base to use information from your database in a usable way.

Bootstrap responsive javascript c3.js charts


Bootstrap Framework
The best solution for responsive Websites, from mobile phone, tablets, monitor to large Display, is bootstrap. Bootstrap with a lot of features in combination with c3.js charts javacript is a must for every web developer. Using opensource community github.

Javascript Framework Angular.js


Angular MVC
Angular.js is a very useful, widespread and up-to-date Javascript framework based on the MVC principle. MVC stands for model view controllers.

The MVC principle removes the link between view and logic. This allows modular programming, Which is easier to maintain and more adaptable because change no longer has to be made to the entire system, But only on the affected components. Therefore, Javascript Angular.js is perfect for large projects.

Charts und diagrams with Javascript chart.js


Nick Downie has developed javascript charts.js using the HTML5 CANVAS Very nice charts and charts created on the website. The Javascript library is only 4.5K in size. Javascript Charts.js includes six different chart types and is clear and easy to implement.

Javascript Luhn Algorithm


$(document).keypress(function(event) { switch(event.which) { case 13:{ $(‚#luhn‘).empty(); var wert = $(‚#knr‘).val(); var sum = 0; var length = wert.length; var parity = length % 2; // $(‚#luhn‘).append(‚ Ergebnis: ‚); $(‚#luhn‘).append(‚ Kartennummer: ‚ + wert + ‚ ‚); // $(‚#luhn‘).append(‚Parity: ‚ + parity + ‚ ‚); for (var i = 0; i < length; i++) { var digit = parseInt(wert.charAt(i)); // $(‚#luhn‘).append(‚Zähler: ‚ + i + ‚ ‚); // $(‚#luhn‘).append(‚1 Wert: ‚ + digit + ‚ ‚); if (i % 2 == parity) { digit *= 2; // $(‚#luhn‘).append(‚2 Wert: ‚ + digit + ‚ ‚); } if (digit > 9) { digit -= 9; // $(‚#luhn‘).append(‚3 Wert: ‚ + digit + ‚ ‚); } sum += digit; // $(‚#luhn‘).append(‚4 Wert: ‚ + digit + ‚ ‚); // $(‚#luhn‘).append(‚Summe: ‚ + sum + ‚ ‚); } if(sum == 0){ $(‚#luhn‘).append(‚Ungültige Nummer ‚); } if (sum % 10 == 0) { $(‚#luhn‘).append(‚Endwert: ‚ + sum + ‚ (richtig) ‚); } if (sum % 10 > 0) { $(‚#luhn‘).append(‚Endwert: ‚ + sum + ‚ (falsch) ‚); } if(!(sum % 10 == 0) && !(sum % 10 > 0)){ $(‚#luhn‘).append(‚Wert nicht erkannt ‚); } if(sum % 10 < 0){ $(‚#luhn‘).append(‚Wert kleiner Null ‚); } break;} default:{break;}

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(); });

Speedup your Page with grunt and .less


Grunt packs your code, your files into a smaller file and saves the loading time of your homepage. Reduced JavaScript, php, html, css files with grunt are recognizable with the name add .min.

Big data and data processing


We are still located in information technology as a leading industrial sector in the back. In data protection, the state is still an open book for hackers.

Thanks to fiber optic cables, transmission speeds have risen sharply in large cities. We are still located in information technology as a leading industrial sector in the back. In data protection, the state is still an open book for hackers.

Conclusion: We welcome all subsidies!

Java Hadoop Big Data


Apache Hadoop is a very fast and powerful algorithm for storage big data. Hadoop is one of the most successful Java Framework transferring data between nodes. Hadoop also working in cars for mobile data transfer and in web application, financial to analize large mass of data quickly. Hadoop is the tool in Telematik, Topic of telekommunication and Informatik.

Insert CSS Stylesheet dynamically with Javascript


Hello dear web developer,

if you dynamically adapt your search to the browser (Internet Explorer, Firefox, Opera, Safari) on your search since your website, we have news for you.

Microsoft has not used the term msie since the Internet Explorer 11 query with the well-known Javascript object method navigator.userAgent.toLowerCase (), you must search for trident instead of msie.

Firefox remains with Gecko / and Safari likewise as before.

Best Regards
Your profistart Team

Javascript promise, async function and await


How to use async functionality in Javascript?

An async function returns a promise. If this promise has done, the await function will be execute. A await function can only exists in async function.

Aysnc loading Example in Javascript:

function loadHeader() { return getAllContent().then(function(content) { return content[0].header; }).catch(function(err) { return { content: 'loading error' }; }); }
New async promise await developing Example in Javascript:
async function getHeader() { try { let content = await getAllContent(); return content[0].header; } catch (err) { return { content: 'loading error' }; } }

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,