Category Archives: Програмиране

Wamp – SSL

·  Download & install WampServer.

·  Open a command prompt (WindowsKey + R > cmd > click OK) and enter the following commands.
cd c:\wamp64\bin\apache\apache2.4.41\bin

openssl genrsa -aes256 -out private.key 2048

openssl rsa -in private.key -out private.key

openssl req -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500 -config c:\wamp64\bin\apache\apache2.4.41\conf\openssl.cnf

Note: You can pretty much answer the questions any way you want though real answers are best. The one question that really matters here is the FQDN. It should be: localhost.

·  Move the private.key and certificate.crt files from c:\wamp64\bin\apache\apache2.4.41\bin to the c:\wamp64\bin\apache\apache2.4.41\conf\key\ folder. If the key folder doesn’t already exist, create it.

·  Using a text editor like Notepad, open c:\wamp64\bin\apache\apache2.4.41\conf\httpd.conf and un-comment following 3 lines:
LoadModule ssl_module modules/
Include conf/extra/httpd-ssl.conf
LoadModule socache_shmcb_module modules/

·  Using a text editor like Notepad, open c:\wamp64\bin\apache\apache2.4.41\conf\extra\httpd-ssl.conf and apply the following changes:
Below the line: <VirtualHost _default_:443>, check the following parameters to ensure they are configured correctly and not commented.
DocumentRoot “c:/wamp64/www”
ServerName localhost:443
SSLSessionCache “shmcb:c:/wamp64/bin/apache/apache2.4.41/logs/ssl_scache(512000)”

ErrorLog “c:/wamp64/bin/apache/apache2.4.41/logs/error.log”
TransferLog “c:/wamp64/bin/apache/apache2.4.41/logs/access.log”
SSLCertificateFile “c:/wamp64/bin/apache/apache2.4.41/conf/key/certificate.crt”
SSLCertificateKeyFile “c:/wamp64/bin/apache/apache2.4.41/conf/key/private.key”

·  Save the file and close it.

·  You are done. To check the validity of file, at the command prompt, enter:
c:\wamp64\bin\apache\apache2.4.41\bin\httpd -t
and then use your web browse to go to https://localhost/

Interspire To Prestashop

Products Table

DROP TABLE IF EXISTS `_mid_products`;
CREATE TABLE IF NOT EXISTS `_mid_products` (
  `product_id` int(11) NOT NULL AUTO_INCREMENT,
  `active_0_1` text DEFAULT NULL,
  `name` text DEFAULT NULL,
  `categories_cs` text DEFAULT NULL,
  `price_tax_excluded` text DEFAULT NULL,
  `tax_rules_id` text DEFAULT NULL,
  `wholesale_price` text DEFAULT NULL,
  `on_sale_0_1` text DEFAULT NULL,
  `discount_amount` text DEFAULT NULL,
  `discount_percent` text DEFAULT NULL,
  `discount_from_yyyy_mm_dd` text DEFAULT NULL,
  `discount_to_yyyy_mm_dd` text DEFAULT NULL,
  `reference_num` text DEFAULT NULL,
  `supplier_reference_num` text DEFAULT NULL,
  `supplier` text DEFAULT NULL,
  `manufacturer` text DEFAULT NULL,
  `ean13` text DEFAULT NULL,
  `upc` text DEFAULT NULL,
  `ecotax` text DEFAULT NULL,
  `width` text DEFAULT NULL,
  `height` text DEFAULT NULL,
  `depth` text DEFAULT NULL,
  `weight` text DEFAULT NULL,
  `delivery_time_of_in_stock_products` text DEFAULT NULL,
  `delivery_time_of_out_of_stock_products_with_allowed_orders` text DEFAULT NULL,
  `quantity` text DEFAULT NULL,
  `minimal_quantity` text DEFAULT NULL,
  `low_stock_level` text DEFAULT NULL,
  `send_me_an_email_when_the_quantity_is_under_this_level` text DEFAULT NULL,
  `visibility` text DEFAULT NULL,
  `additional_shipping_cost` text DEFAULT NULL,
  `unity` text DEFAULT NULL,
  `unit_price` text DEFAULT NULL,
  `summary` text DEFAULT NULL,
  `description` text DEFAULT NULL,
  `tags_cs` text DEFAULT NULL,
  `meta_title` varchar(255) DEFAULT NULL,
  `meta_keywords` varchar(255) DEFAULT NULL,
  `meta_description` text DEFAULT NULL,
  `url_rewritten` text DEFAULT NULL,
  `text_when_in_stock` text DEFAULT NULL,
  `text_when_backorder_allowed` text DEFAULT NULL,
  `available_for_order_0_1` text DEFAULT NULL,
  `product_available_date` text DEFAULT NULL,
  `product_creation_date` text DEFAULT NULL,
  `show_price_0_1` text DEFAULT NULL,
  `image_urls_cs` text DEFAULT NULL,
  `image_alt_texts_cs` text DEFAULT NULL,
  `delete_existing_images_0_1` text DEFAULT NULL,
  `feature_cs` text DEFAULT NULL,
  `available_online_only_0_1` text DEFAULT NULL,
  `condition_` text DEFAULT NULL,
  `customizable_0_1` text DEFAULT NULL,
  `uploadable_files_0_1` text DEFAULT NULL,
  `text_fields_0_1` text DEFAULT NULL,
  `out_of_stock_action` text DEFAULT NULL,
  `virtual_product` text DEFAULT NULL,
  `file_url` text DEFAULT NULL,
  `number_of_allowed_downloads` text DEFAULT NULL,
  `expiration_date` text DEFAULT NULL,
  `number_of_days` text DEFAULT NULL,
  `id_name_of_shop` text DEFAULT NULL,
  `advanced_stock_management` text DEFAULT NULL,
  `depends_on_stock` text DEFAULT NULL,
  `warehouse` text DEFAULT NULL,
  `acessories_cs` text DEFAULT NULL,
  PRIMARY KEY (`product_id`)

Categories table

DROP TABLE IF EXISTS `_mid_categories`;
CREATE TABLE IF NOT EXISTS `_mid_categories` (
  `active` int(11) NOT NULL DEFAULT 1,
  `name` text DEFAULT NULL,
  `parent_category` text DEFAULT NULL,
  `root_category` text DEFAULT NULL,
  `description` text DEFAULT NULL,
  `meta_title` text DEFAULT NULL,
  `meta_keyword` varchar(255) DEFAULT NULL,
  `meta_description` text DEFAULT NULL,
  `url_rewritten` text DEFAULT NULL,
  `image` text DEFAULT NULL,
  PRIMARY KEY (`id`)


fill the categories table:

insert into _mid_categories 
SELECT (categoryid+3) as id,catvisible as active,(catparentid+3) as `parent_category`,catdesc as description,catname as meta_title,catname as `name`,catmetakeywords as meta_keyword,catmetadesc as meta_description,replace(catname,' ','-') as url_rewritten FROM isc_categories ORDER BY catsort;

UPDATE `_mid_categories` set root_category=1 WHERE parent_category='0';
UPDATE `_mid_categories` set root_category=0 WHERE parent_category!='0';
UPDATE _mid_categories targetTable

LEFT JOIN _mid_categories sourceTable ON

UPDATE `_mid_categories` SET parent_category='2' WHERE parent_category is null;

And for exporting it to csv you have to use this query:

SELECT  mc.* FROM `_mid_categories` as mc order by CASE WHEN parent_category>id THEN cast(id as unsigned) ELSE cast(parent_category as unsigned) END ASC,id asc

this fill the products table:

truncate _mid_products;
insert into _mid_products 
(`product_id`, `active_0_1`, `name`, `categories_cs`, `price_tax_excluded`, `tax_rules_id`, `wholesale_price`, `on_sale_0_1`, `discount_amount`, `discount_percent`, `discount_from_yyyy_mm_dd`, `discount_to_yyyy_mm_dd`, `reference_num`, `supplier_reference_num`, `supplier`, `manufacturer`, `ean13`, `upc`, `ecotax`, `width`, `height`, `depth`, `weight`, `delivery_time_of_in_stock_products`, `delivery_time_of_out_of_stock_products_with_allowed_orders`, `quantity`, `minimal_quantity`, `low_stock_level`, `send_me_an_email_when_the_quantity_is_under_this_level`, `visibility`, `additional_shipping_cost`, `unity`, `unit_price`, `summary`, `description`, `tags_cs`, `meta_title`, `meta_keywords`, `meta_description`, `url_rewritten`, `text_when_in_stock`, `text_when_backorder_allowed`, `available_for_order_0_1`, `product_available_date`, `product_creation_date`, `show_price_0_1`, `image_urls_cs`, `image_alt_texts_cs`, `delete_existing_images_0_1`, `feature_cs`, `available_online_only_0_1`, `condition_`, `customizable_0_1`, `uploadable_files_0_1`, `text_fields_0_1`, `out_of_stock_action`, `virtual_product`, `file_url`, `number_of_allowed_downloads`, `expiration_date`, `number_of_days`, `id_name_of_shop`, `advanced_stock_management`, `depends_on_stock`, `warehouse`, `acessories_cs`) 

p.productid as `product_id`,
p.prodvisible as `active_0_1`,
replace(p.prodname,'#','No ') as `name`,
GROUP_CONCAT(DISTINCT (cats.categoryid+3) ORDER BY cats.categoryid asc SEPARATOR ',') as `categories_cs`,
(p.prodprice/1.2) as `price_tax_excluded`,
'1' as `tax_rules_id`,
p.prodprice as `wholesale_price`,
'0' as `on_sale_0_1`,
null as `discount_amount`,
null as `discount_percent`,
null as `discount_from_yyyy_mm_dd`,
null as `discount_to_yyyy_mm_dd`,
p.prodcode as `reference_num`,
null `supplier_reference_num`,
null `supplier`,
brands.brandname as `manufacturer`,
null as `ean13`,
null as `upc`,
null as `ecotax`,
null as `width`,
null as `height`,
null as `depth`,
p.prodweight as `weight`,
null as `delivery_time_of_in_stock_products`,
null as `delivery_time_of_out_of_stock_products_with_allowed_orders`,
'999999' as `quantity`,
null as `minimal_quantity`,
null as `low_stock_level`,
null as `send_me_an_email_when_the_quantity_is_under_this_level`,
'both' as `visibility`,
null as `additional_shipping_cost`,
null as `unity`,
null as `unit_price`,
SUBSTRING(p.prodmetadesc,0,800) as `summary`,
p.proddesc as `description`,
null as `tags_cs`,
p.prodname as `meta_title`,
p.prodmetakeywords as `meta_keywords`,
SUBSTRING(p.prodmetadesc,0,512) as `meta_description`,
replace(p.prodname,' ','_') as `url_rewritten`,
null as `text_when_in_stock`,
null as `text_when_backorder_allowed`,
p.prodallowpurchases as `available_for_order_0_1`,
DATE_FORMAT(FROM_UNIXTIME(p.proddateadded), '%Y-%m-%d') AS `product_available_date`,
DATE_FORMAT(FROM_UNIXTIME(p.proddateadded), '%Y-%m-%d') AS `product_creation_date`,
'1' as `show_price_0_1`,
GROUP_CONCAT(DISTINCT CONCAT('',imgs.imagefile) ORDER BY imgs.imagesort asc SEPARATOR ',')  as `image_urls_cs`,
null as `image_alt_texts_cs`,
'0' as `delete_existing_images_0_1`,
null as `feature_cs`,
'0' as `available_online_only_0_1`,
LOWER(p.prodcondition) as `condition_`,
'0' as `customizable_0_1`,
'0' as `uploadable_files_0_1`,
'0' as `text_fields_0_1`,
null as `out_of_stock_action`,
null as `virtual_product`,
null as `file_url`,
null as `number_of_allowed_downloads`,
null as `expiration_date`,
null as `number_of_days`,
'1' as `id_name_of_shop`,
null as `advanced_stock_management`,
null as `depends_on_stock`,
null as `warehouse`,
null as `acessories_cs`

FROM isc_products as p
LEFT JOIN isc_brands as brands ON p.prodbrandid=brands.brandid
LEFT JOIN isc_categoryassociations as cats ON p.productid=cats.productid
LEFT JOIN (SELECT * FROM isc_product_images where imagefile NOT like '%_tiny.%' AND ((REPLACE(imagefile,'_thumb.','.')!=imagefile AND REPLACE(imagefile,'_thumb.','.') NOT IN (SELECT imagefile FROM isc_product_images) ) OR REPLACE(imagefile,'_thumb.','.')=imagefile )  ) as imgs ON p.productid=imgs.imageprodid

/*WHERE p.productid=9096*/

group by p.productid;

UPDATE `_mid_products` SET meta_title=REPLACE(meta_title,'>',' ');
UPDATE `_mid_products` SET meta_title=REPLACE(meta_title,'<',' ');
UPDATE `_mid_products` SET meta_description=REPLACE(meta_description,'>',' ');
UPDATE `_mid_products` SET meta_description=REPLACE(meta_description,'<',' ');
UPDATE `_mid_products` SET meta_keywords=REPLACE(meta_keywords,'>',' ');
UPDATE `_mid_products` SET meta_keywords=REPLACE(meta_keywords,'<',' ');
UPDATE `_mid_products` SET `name`=REPLACE(`name`,'>',' ');
UPDATE `_mid_products` SET `name`=REPLACE(`name`,'<',' ');
UPDATE _mid_products SET meta_description=SUBSTRING(meta_description,0,512);

Export it to CSV by just using phpMyAdmin – export function – CSV

Use this query to Export Combinations

pvc.vcproductid as product_id,
'' as productreference,
GROUP_CONCAT(CONCAT(CONCAT(pvo.voname,'-',vovariationid,'-',REPLACE(REPLACE(pv.vname,':','-'),',','-')),':select:',pvo.vovaluesort) ORDER BY pvo.vovaluesort asc SEPARATOR ',' ) as attribute,
GROUP_CONCAT(CONCAT((case when pvo.vovalue='' then '-' else pvo.vovalue end),':',pvo.vooptionsort) ORDER BY pvo.vovaluesort asc SEPARATOR ',' ) as val,
CASE WHEN pvc.vcenabled=1 THEN '999999' ELSE 0 END as qty
FROM  isc_product_variation_combinations pvc

LEFT JOIN isc_product_variation_options pvo ON pvo.vovariationid=pvc.vcvariationid AND FIND_IN_SET(pvo.voptionid,pvc.vcoptionids)
LEFT JOIN isc_product_variations pv ON pvc.vcvariationid=pv.variationid 

/*WHERE pvc.vcproductid=9096*/
WHERE pvc.vcproductid>0
GROUP BY pvc.combinationid;

Appwrite gives your project a better starting point by abstracting most of you common backend tasks behind a simple to use REST API.

We need to do things differently, and that’s why we created Appwrite. Appwrite is an open-source backend server that aims to abstract the complexity behind repeating software development tasks.

Appwrite gives your project a better starting point by abstracting most of you common backend tasks behind a simple to use REST API.

Appwrite provides software developers with APIs and SDKs to quickly implement functions that are repetitive across their projects like user authentication, file management, localization, database management, and more.

Appwrite also provides teams with tools like Appwrite Webhooks and Appwrite Background Tasks to allow maximum flexibility and customization to match each and each product and different scenarios different teams might face.

Creating an abstraction layer between complex function and developers. Appwrite

Appwrite comes with built-in and centralized security and is agnostic to the technologies or frameworks developers use to build their apps. Appwrite hides the unnecessary complexity required to make a fast and secure application, allowing teams to create high-end products, quickly and without compromising, features, security, or quality.

By giving software projects a better starting point, we aim to provide software developers with more time to innovate, tackle new problems, and create better products. There is no reason we, as an industry, will keep on struggling with the same old challenges while we can leverage open-source to share solutions and build better and more secure tools or services.

Serverless is great, but it can’t work for every project. Appwrite can replace your backend servers or work alongside them.

It was vital for us to leave the power and the flexibility in the developer’s hands. It’s up for them to decide how they want to set their architecture

It’s important to understand that unlike other serverless solutions, Appwrite does not aim to magically replace backend servers. Instead, it attempts to give new projects a better starting point. Appwrite allows developers to replace or extend their existing backend server functionality by using tools like webhooks and background functions.

You can use Appwrite as a standalone API directly against your client app or together with your own backend servers. Appwrite is unopinionated about the way the developer wishes to use it. We give you the tools to make any decision you want about your app, technology stack, or integrations.

Appwrite dashboard allows developers to monitor and manage their backend activity

What’s Next?

Using Appwrite as a code abstraction layer, we hope to give developers and small to big organizations more time to focus on their products and create more room for innovation. We, as a software industry, should always try and improve, and we hope Appwrite is another step in that direction.

Learn More

You can learn more about Appwrite features, API, and integration by visiting Appwrite official website or Github repository. You can also follow Appwrite news and announcements on our Twitter or Facebook accounts.

Useful PHP libraries

Super fast and easy Social Media Sharing Buttons. No JavaScript. No tracking.

Goutte, a simple PHP Web Scraper

Goutte is a screen scraping and web crawling library for PHP.
Goutte provides a nice API to crawl websites and extract data from the HTML/XML responses.

Twig, the flexible, fast, and secure template language for PHP

Twig is a template language for PHP, released under the new BSD license (code and documentation).
Twig uses a syntax similar to the Django and Jinja template languages which inspired the Twig runtime environment.

Medoo : PHP database framework

The Lightest PHP database framework to accelerate development.

Medoo is extremely lightweight with only one file, easy-to-use, easy-to-learn, and optimized for high performance to increase the development experience and user experience for web application. It`s suitable for every PHP development project with SQL database needed.

  • Lightweight: Only 7.8KB, one file included.
  • Easy: Extremely easy to learn and use, friendly construction.
  • Powerful: Support various common SQL queries.
  • Compatible: Support various SQL database, including MySQL, MSSQL, SQLite and more.
  • Security: Prevent SQL injection.
  • Free: Under MIT license, you can use it anywhere if you want.

РНР бенчмаркове

Много интересна страничка с различни бенчмаркове на PHP функции/операции. Ако огледате обстойно, ще разберете коя функция да ползвате с по-голямо бързодействие.