Anleitung: PostgreSQL-Servers unter xampp installieren

19. Januar 2016 at 15:51

db

Ein PostgreSQL-Servers unter xampp installieren ist gar nicht so schwer, hier die Anleitung dazu:

Nach dem XAMPP installiert ist legt man im Ordner unter „C:\XAMPP“ (oder wo xampp installiert wurde) ein neuen Ordner namens „pgsql“ sowie darin ein Ordner „data“ (also C:\xampp\pgsql\data) an. Die PostgreSQL könnt ihr laden unter http://www.postgresql.org/download/ .

Startet die Installationsroutine von postgresql und ändert das Installationsverzeichnis zu „C:\XAMPP\pgsql“.

Danach installieren wir phpPgAdmin, ein adäquat zu phpMyAdmin um die Datenbank zu verwalten.
Dazu legen wir im xampp Ordner den Ordner „C:\XAMPP\phpPgAdmin“ an.
phpPgAdmin downloaden unter http://phppgadmin.sourceforge.net/doku.php?id=download

Jetzt müssen wir xampp noch dazu bringen auch mit der PostgreSQL zusammen zuarbeiten.
Dazu editieren wir die Datei „C:\XAMPP\phpPgAdmin\conf\config.inc.php“.
Sucht dort nach der Zeile

$conf[‚extra_login_security‘] = true;

und ändert diese in

$conf[‚extra_login_security‘] = false;

In der Datei „php.ini“ im Verzeichnis „C:\XAMPP\php“ sucht ihr die Zeile

;extension=php_pgsql.dll

und ändert diese in

extension=php_pgsql.dll

In der Datei „http-xampp.conf“ im Verzeichnis „C:\XAMPP\apache\conf\extra“ sucht ihr nach dem folgenden AbschnittfügtAlias /phpmyadmin „C:/XAMPP/phpMyAdmin/“
<Directory „C:/XAMPP/phpMyAdmin“>
AllowOverride AuthConfig
</Directory>

Und fügt darunter die folgende Zeile hinzu:

Alias /phppgadmin „C:/XAMPP/phppgadmin/“
<Directory „C:/XAMPP/phppgadmin“>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require local
Order Deny,Allow
Allow from all
</Directory>

Jetzt den Apache-Server neu starten (geht direkt über das XAMPP Control-Programm) und Ihr könnt über den Web-Browser und der URL (http://localhost/phppgadmin) auf den PostgreSQL-Server zugreifen.

Falls benötigt, der Default-User ist „postgres“ 😉

Please share this article von facebook & google plus or where you want, thank you!

GD Star Rating
loading...
GD Star Rating
loading...

Magento 1.9.2.2 Upgrade Conflict issue / SUPEE-6788 security patch – Solution for this problem

10. November 2015 at 11:25

db

Magento has released a new upgrade for Magento which includes the SUPEE-6788 Patch Bundle. Note that this upgrade can break some modules which are not correctly coded.

I have tested the upgrade thru Magento Connect Manager but it failed.

I am testing in Linux Bash / Windows CLI:

chmod 755 mage
sudo -u www-data ./mage list-upgrades
sudo -u www-data ./mage upgrade-all

I have the same error in command line

Error:
upgrade-all: Failed to delete files: /home/data/www/magento_dev/./pkginfo/Mage_All_Latest.txt
Check permissions
Error:
upgrade-all: Package community/Interface_Adminhtml_Default 1.9.2.2 conflicts with: community/Mage_All_Latest 1.9.2.1
Error:
upgrade-all: Package community/Interface_Frontend_Default 1.9.2.2 conflicts with: community/Mage_All_Latest 1.9.2.1
Error:
upgrade-all: Package community/Interface_Install_Default 1.9.2.2 conflicts with: community/Mage_All_Latest 1.9.2.1
Error:
upgrade-all: Package community/Mage_Downloader 1.9.2.2 conflicts with: community/Mage_All_Latest 1.9.2.1
Error:
upgrade-all: Package community/Mage_Centinel 1.9.2.2 conflicts with: community/Mage_All_Latest 1.9.2.1
...

On stack exchange, there are some idea how to proceed.

Solution – First Step

cd pkginfo
# rm -Rf Mage_All_Latest.txt Mage_All.txt
# cd ..
# sudo -u www-data ./mage upgrade-all
Installing package community/Mage_All_Latest 1.9.2.2
Package community/Mage_All_Latest 1.9.2.2 installed successfully
Starting to download Interface_Adminhtml_Default-1.9.2.2.tgz ...
...done: 1,014,275 bytes
Installing package community/Interface_Adminhtml_Default 1.9.2.2
Package community/Interface_Adminhtml_Default 1.9.2.2 installed successfully
Starting to download Interface_Frontend_Default-1.9.2.2.tgz ...
...done: 747,738 bytes
Installing package community/Interface_Frontend_Default 1.9.2.2
...

Now delete the maintenance.flag file and your shop is updated and online! :-)

Please share this article von facebook & google plus or where you want, thank you!

GD Star Rating
loading...
GD Star Rating
loading...

Magento MySQL Database Error: MySQL server has gone away

7. Oktober 2015 at 15:51

sql-statement-mysql

If you get an exception error like this in the Magento Exception-Log-File:

ERR (3): exception ‚PDOException‘ with message ‚SQLSTATE[HY000]: General error: 2006 MySQL server has gone away‘ in …/lib/Zend/Db/Statement/Pdo.php:228 Stack trace:

Explanation: It is clearly visible that this is the MySQL timeout error. When you are using shared hosting and you get the huge traffic, so in this case a huge requests sends to MySQL and your request wait for a long time and finally timeout. Another case, If there is one DB connection and fetch some data from DB and do some stuff longer than DB timeout and now if you try to fetch data with same connection you will get the error MySQL server has gone away.

Solutions: You should use dedicated hosting if you are getting a huge traffic to your website instead of shared hosting. Secondly, you should close the DB connection after fetching data and create new DB connection to fetch data again and close the DB connection. If the problem remain same then you need to increase wait_timeout, connect_timeout and max_allowed_packet in my.ini or my.cnf file.

I have changed my my.ini settings as below:
max_allowed_packet = 32M
wait_timeout = 1800
connect_timeout = 120

To change these in your mysql’s my.cnf/my.ini configuration file follow below steps:
For windows: open mysql-install-dir/bin/my.ini and set wait_timeout = 1800 , max_allowed_packet = 32M and connect_timeout = 120 then save and restart mysql server.

For Linux: open /etc/mysql/my.cnf and set wait_timeout = 1800 , max_allowed_packet = 32M and connect_timeout = 120 then save and restart mysql server.

This solution solved my problem of SQLSTATE[HY000]: General error: 2006 MySQL server has gone away.

Please share this article von facebook & google plus or where you want, thank you!

GD Star Rating
loading...
GD Star Rating
loading...

Fix: TypeError: jQuery(.sf-menu).superfish is not a function

14. September 2015 at 15:40

XHTML

If you’re working with the superfish drop down menu and you’re getting the error message „TypeError: jQuery(.sf-menu).superfish is not a function“ it is possible that you’re loading the jquery script twice, e.g.:

<script type="text/javascript" src="/assets/js/jquery-1.2.6.min.js"></script>
<script type="text/javascript" src="/skin/frontend/default/default/js/jquery-1.11.1.min.js"></script>

Solution 1

Remove the dublicated js-implementation (remove one of this lines)

Solution 2

If you need to include two versions of jquery on the same page because of plugin support or so …
Change the lines

jQuery(function(){
	jQuery('.sf-menu').superfish()
})

to

jQuery(function(){
	$(document).ready(function(){
		jQuery('.sf-menu').superfish()
	});
})

if you get an error like „$(document).ready is not a function“
use:

(function($){
	$(document).ready(function(){
		$('.sf-menu').superfish()
	});
})(jQuery);

Please share this article von facebook & google plus or where you want, thank you!

GD Star Rating
loading...
GD Star Rating
loading...

Magento: Access Denied errors after installing SUPEE-6285 or since Magento 1.9.2.1 – ACL Error – Solution

13. August 2015 at 15:06

If you use restricted admin accounts, some menus of third party extensions might not work anymore for them. The reason is that the default return value of Mage_Adminhtml_Controller_Action::_isAllowed() has been changed from true to Mage::getSingleton(‚admin/session‘)->isAllowed(‚admin‘). Extensions that do not override this method in their admin controllers because they don’t use the ACL, now need the „ALL“ privilege.

The only solution is to patch the extensions and add this method to all their admin controllers:

protected function _isAllowed()
{
  return true;
}

Or if they actually have an ACL resource defined in etc/adminhtml.xml:

protected function _isAllowed()
{
  return Mage::getSingleton('admin/session')->isAllowed('ENTER RESOURCE IDENTIFIER HERE'); //e.g. 'admin/sales/productreturn'</pre>
} 

 

Please share this article von facebook & google plus or where you want, thank you!

GD Star Rating
loading...
GD Star Rating
loading...

Magento: Product options are wrong if order edit in admin and last order article is taken

15. Juli 2015 at 12:48

php code

If you edit an order and take over last article it is possible that the wrong product options are mapped.

The reason is that the wrong options are taken – not the „options“ taken – magento get the „info_buyRequest“-options from the database, but sometimes the „options“ array has the options data that you need.

You can solve this problem with overwriting the „getBuyRequest()“ function in app/code/local/Mage/Sales/Model/Order/Item.php with this php code:

/**
 * Returns formatted buy request - object, holding request received from
 * product view page with keys and options for configured product
 *
 * @return Varien_Object
 */
public function getBuyRequest()
{
    $option = $this-&gt;getProductOptionByCode('info_buyRequest');   // this get the wrong options
    $option2 = $this-&gt;getProductOptionByCode('options');
    foreach($option2 as $option_tmp) {
        if($option_tmp['option_type'] == 'area'
            || $option_tmp['option_type'] == 'file'
            || $option_tmp['option_type'] == 'field'
            || $option_tmp['option_type'] == 'date'
            || $option_tmp['option_type'] == 'date_time'
            || $option_tmp['option_type'] == 'time'
        ) {
            $option['options'][$option_tmp['option_id']] = $option_tmp['value'];
        } elseif($option_tmp['option_type'] == 'drop_down'
            &amp;&amp; $option_tmp['label'] == 'Farbe'
            &amp;&amp; $productOptions = $this-&gt;getProduct()-&gt;getOptions()[$option_tmp['option_id']]-&gt;getValues()
        ) {
            foreach($productOptions as $productOption) {
                if($productOption-&gt;getData('title') == $option_tmp['value']) {
                    $option['options'][$option_tmp['option_id']] = $productOption-&gt;getData('option_type_id');
                }
            }
        } else {
            $option['options'][$option_tmp['option_id']][0] = $option_tmp['option_value'];
        }
    }
    unset($option2, $option_tmp, $productModel, $attr);
    if (!$option) {
        $option = array();
    }
    $buyRequest = new Varien_Object($option);
    $buyRequest-&gt;setQty($this-&gt;getQtyOrdered() * 1);
    return $buyRequest;
}

 

Please share this article von facebook & google plus or where you want, thank you!

GD Star Rating
loading...
GD Star Rating
loading...

Anonymise Magento database

19. Mai 2015 at 09:39

sql-statement-mysql

to anonymise the magento database you can use the following sql:

--
-- Anonymise Magento database
--
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
UPDATE `admin_user` SET
  `firstname` = CONCAT('Firstname-', `user_id`),
  `lastname` = CONCAT('Lastname-', `user_id`),
  `email` = CONCAT('admin-', `user_id`, '@test.com'),
  `username` = CONCAT('username-', `user_id`);
UPDATE `customer_entity` SET
  `email` = CONCAT('email-', `entity_id`, '@test.com');
UPDATE `sales_flat_order` SET
  `customer_firstname` = CONCAT('Firstname-', `customer_id`),
  `customer_middlename` = CONCAT('Middlename-', `customer_id`),
  `customer_lastname` = CONCAT('Lastname-', `customer_id`),
  `customer_email` = CONCAT('email-', `customer_id`, '@test.com');
UPDATE `sales_flat_order_address` SET
  `firstname` = CONCAT('Firstname-', `customer_id`),
  `middlename` = CONCAT('Middlename-', `customer_id`),
  `lastname` = CONCAT('Lastname-', `customer_id`),
  `email` = CONCAT('admin-', `customer_id`, '@test.com');
UPDATE `sales_flat_quote` SET
  `customer_firstname` = CONCAT('Firstname-', `customer_id`),
  `customer_middlename` = CONCAT('Middlename-', `customer_id`),
  `customer_lastname` = CONCAT('Lastname-', `customer_id`),
  `customer_email` = CONCAT('email-', `customer_id`, '@test.com');
UPDATE `sales_flat_quote_address` SET
  `firstname` = CONCAT('Firstname-', `customer_id`),
  `middlename` = CONCAT('Middlename-', `customer_id`),
  `lastname` = CONCAT('Lastname-', `customer_id`),
  `email` = CONCAT('admin-', `customer_id`, '@test.com');
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
UNLOCK TABLES;

Please share this article von facebook & google plus or where you want, thank you!

GD Star Rating
loading...
GD Star Rating
loading...

Magento: Move Database Sales, Customers & Invoices

11. Mai 2015 at 16:07

sql-statement-mysql

Disabling Magento during Transfer

First disable magento in the transfer time.
create a blank file named maintenance.flag and place it on the root of your Magento install.

Transferring Customers & Sales

The first step is to transfer all the tables and data starting with „customer_“ and „sales_“, which are as follows on a Magento 1.7.0.2 – 1.9.0.1 install:

‚customer_address_entity‘
‚customer_address_entity_datetime‘
‚customer_address_entity_decimal‘
‚customer_address_entity_int‘
‚customer_address_entity_text‘
‚customer_address_entity_varchar‘
‚customer_eav_attribute‘
‚customer_eav_attribute_website‘
‚customer_entity‘
‚customer_entity_datetime‘
‚customer_entity_decimal‘
‚customer_entity_int‘
‚customer_entity_text‘
‚customer_entity_varchar‘
‚customer_form_attribute‘
‚customer_group‘

 And now export the data from the „sales_“ tables:

„sales_bestsellers_aggregated_daily“
„sales_bestsellers_aggregated_monthly“
„sales_bestsellers_aggregated_yearly“
„sales_billing_agreement“
„sales_billing_agreement_order“
„sales_flat_creditmemo“
„sales_flat_creditmemo_comment“
„sales_flat_creditmemo_grid“
„sales_flat_creditmemo_item“
„sales_flat_invoice“
„sales_flat_invoice_comment“
„sales_flat_invoice_grid“
„sales_flat_invoice_item“
„sales_flat_order“
„sales_flat_order_address“
„sales_flat_order_grid“
„sales_flat_order_item“
„sales_flat_order_payment“
„sales_flat_order_status_history“
„sales_flat_quote“
„sales_flat_quote_address“
„sales_flat_quote_address_item“
„sales_flat_quote_item“
„sales_flat_quote_item_option“
„sales_flat_quote_payment“
„sales_flat_quote_shipping_rate“
„sales_flat_shipment“
„sales_flat_shipment_comment“
„sales_flat_shipment_grid“
„sales_flat_shipment_item“
„sales_flat_shipment_track“
„sales_invoiced_aggregated“
„sales_invoiced_aggregated_order“
„sales_order_aggregated_created“
„sales_order_aggregated_updated“
„sales_order_status“
„sales_order_status_label“
„sales_order_status_state“
„sales_order_tax“
„sales_order_tax_item“
„sales_payment_transaction“
„sales_recurring_profile“
„sales_recurring_profile_order“
„sales_refunded_aggregated“
„sales_refunded_aggregated_order“
„sales_shipping_aggregated“
„sales_shipping_aggregated_order“
„salesrule“
„salesrule_coupon“
„salesrule_coupon_usage“
„salesrule_customer“
„salesrule_customer_group“
„salesrule_label“
„salesrule_product_attribute“
„salesrule_website“

Change Last Order ID for Sales

Next, a step that is fairly easy, but that is often missed is the changing of the last entity ID for orders, invoices, credit memos and shipments. Otherwise, Magento will ignore the sales data that did not exist prior to the transfer.
For example: Imagine a Magento store has 9 orders (both development and production), the last orders‘ id would probably be 100000009.

During development, your production website acquires 3 additional orders (a total of 12 orders).

After moving your live sites‘ sales_ tables, your development site will reflect the 12 orders correctly, but will still count from 9, instead of 12.

Hence, the next order will have an ID of 100000010 instead of 100000013, unless the last order ID is updated. The same applies for invoices, shipping and credit memos.

The fix is simple! Simply edit the table eav_entity_store and update the increment_last_id column with the last id used for each row. Each rows‘ entity type can be found in the table eav_entity_type. Default the entity types in Magento are:

    5 = order
    6 = invoice
    7 = creditmemo
    8 = shipment

That should be all that’s needed for a simple customer and sales update on two, otherwise identical Magento 1.7.0.2 – 1.9.0.1 sites.

Please share this article von facebook & google plus or where you want, thank you!

GD Star Rating
loading...
GD Star Rating
loading...

Magento: Save admin name to order_status change using an Observer

28. April 2015 at 15:24

php code

config.xml:

<adminhtml>
  <events>
    <sales_order_status_history_save_before>
      <observers>
        <module_status_history_save_before>
          <class>module/observer</class>
          <method>addUserNameBeforeComment</method>
        </module_status_history_save_before>
      </observers>
    </sales_order_status_history_save_before>
  </events>
</adminhtml>

Observer.php:

public function addUserNameBeforeComment($observer)
{
        $data = '<strong>' . Mage::getSingleton('admin/session')->getUser()->getFirstname() . ' ' . Mage::getSingleton('admin/session')->getUser()->getLastname() . ': </strong>';
        $history = Mage::app()->getRequest()->getPost('history');
        if ($history && isset($history['comment']) && $history['comment'] != '') {
            $history['comment'] = $data . $history['comment'];
            Mage::app()->getRequest()->setPost('history', $history);
        }
}

 

Please share this article von facebook & google plus or where you want, thank you!

GD Star Rating
loading...
GD Star Rating
loading...

MySQL Query Sammlung / MySQL Query Library

8. April 2015 at 17:34

sql-statement-mysql

Some MySQL Querys which you need by the programming with php / mysql or  magento:

MySQL Update with sub-select: Update a value of an option, e.g. „price“, where option-name is like „optionname“

UPDATE catalog_product_option_type_price t1
SET t1.price='30'
WHERE t1.option_type_id in (SELECT option_type_id FROM catalog_product_option_type_title WHERE `title` like '%optionname%');

Please share this article von facebook & google plus or where you want, thank you!

GD Star Rating
loading...
GD Star Rating
loading...