mandag den 4. december 2017

Solve Error "To change the IDENTITY property of a column, the column needs to be dropped and recreated"

The problem "To change the IDENTITY property of a column, the column needs to be dropped and recreated", I think, comes from the following migration code:

migrationBuilder.table<int>(
                name: "Id",
                table: "AspNetUserClaims",
                nullable: false)
                .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
            migrationBuilder.AddColumn<int>(
                name: "Id",
                table: "AspNetRoleClaims",
                nullable: false)
                .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

The way to solve those is to actually drop the table and create it again:


            migrationBuilder.DropTable(
                name: "AspNetUserClaims");
            migrationBuilder.DropTable(
                name: "AspNetRoleClaims");
            migrationBuilder.CreateTable(
                name: "AspNetUserClaims",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("Autoincrement", true),
                    ClaimType = table.Column<string>(nullable: true),
                    ClaimValue = table.Column<string>(nullable: true),
                    UserId = table.Column<string>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AspNetUserClaims_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });
            migrationBuilder.CreateTable(
                name: "AspNetRoleClaims",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("Autoincrement", true),
                    ClaimType = table.Column<string>(nullable: true),
                    ClaimValue = table.Column<string>(nullable: true),
                    RoleId = table.Column<string>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
                        column: x => x.RoleId,
                        principalTable: "AspNetRoles",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

onsdag den 30. marts 2016

public $totalPrice;public $increment_id; //aka. increment ID in magento.public $storeName;public $storeUrl;public $logoUrl;public $secret; // not really nessesary but still here as a perhaps future implementationpublic $time;public $date;public $desc;public $sendTrashPrice;public $transactionID;

function __construct($_totalPrice, $_increment_id, $_storeName, $_storeUrl, $_logoUrl){    $this->totalPrice = $_totalPrice;    $this->_increment_id = $_increment_id;    $this->storeName = $_storeName;    $this->storeUrl = $_storeUrl;    $this->logoUrl = $_logoUrl;}

Notice the _increment_id

it creates a seperate field for that variable and the other one will stay null

onsdag den 2. marts 2016

a bad translator



/*********************** * Formats the text to danish so this can be send through email. * @param $json * @return string * ***********************/
function format_text($json){    //$json must be decoded else it will not work.    $text = "";    $responseIterator = new RecursiveIteratorIterator(        new RecursiveArrayIterator($json),        RecursiveIteratorIterator::SELF_FIRST);
    foreach ($responseIterator as $key => $val) {        if(is_array($val)) {            //order, items, (hver tal i arrayet), addresses, shipping, billing            switch($key){                case "order":                    $text .= "ordre: " . "</br>";                    break;                case "items":                    $text .= "vare: " . "</br>";                    break;                case "addresses":                    $text .= "addresser: " . "</br>";                    break;                case "shipping":                    $text .= "forsendelsinformation: " . "</br>";                    break;                case "billing":                    $text .= "faktureringsinformation: " . "</br>";                    break;
            }
        } else {
            //increment_id, name, width, height, qty_ordered, entity_id, parent_id, customer_address_id, quote_address_id, region_id, customer_id,            // fax, region, postcode, lastname, street, city, email, telephone, country_id, firstname, address_type, prefix, middlename, suffix, company            switch($key){                case "increment_id":                    $text .= "<p class='email-value'>ordrenummer: " . $val . "</p>";                    break;                case "name":                    $text .= "<p class='email-value'>varenavn: " . $val . "</p>";                    break;                case "width":                    $text .= "<p class='email-value'>bredde: " . $val . "</p>";                    break;                case "height":                    $text .= "<p class='email-value'>højde: " . $val . "</p>";                    break;                case "qty_ordered":                    $text .= "<p class='email-value'>antal: " . $val . "</p>";                    break;                case "entity_id":                    $text .= "<p class='email-value'>forsendelses id: " . $val . "</p>";                    break;                case "parent_id":                    $text .= "<p class='email-value'>parent_id: " . $val . "</p>";                    break;                case "customer_address_id":                    $text .= "<p class='email-value'>kunde addresse id " . $val . "</p>";                    break;                case "quote_address_id":                    $text .= "<p class='email-value'>quote_address_id: " . $val . "</p>";                    break;                case "region_id":                    $text .= "<p class='email-value'>region_id: " . $val . "</p>";                    break;                case "customer_id":                    $text .= "<p class='email-value'>kunde id: " . $val . "</p>";                    break;                case "fax":                    $text .= "<p class='email-value'>fax: " . $val . "</p>";                    break;                case "region":                    $text .= "<p class='email-value'>region: " . $val . "</p>";                    break;                case "postcode":                    $text .= "<p class='email-value'>postnummer: " . $val . "</p>";                    break;                case "lastname":                    $text .= "<p class='email-value'>efternavn: " . $val . "</p>";                    break;                case "street":                    $text .= "<p class='email-value'>gade: " . $val . "</p>";                    break;                case "city, ":                    $text .= "<p class='email-value'>by: " . $val . "</p>";                    break;                case "email":                    $text .= "<p class='email-value'>email: " . $val . "</p>";                    break;                case "telephone":                    $text .= "<p class='email-value'>telefon nummer: " . $val . "</p>";                    break;                case "country_id":                    $text .= "<p class='email-value'>landsid: " . $val . "</p>";                    break;                case "firstname":                    $text .= "<p class='email-value'>fornavn: " . $val . "</p>";                    break;                case "address_type":                    $text .= "<p class='email-value'>addresse type " . $val . "</p>";                    break;            }        }    }    return $text;}

fredag den 22. januar 2016

error about local\Amasty\Rules\Model\SalesRule\Rule\Condition\Product\Combine.php

ERROR about
local\Amasty\Rules\Model\SalesRule\Rule\Condition\Product\Combine.php
Using $this when not in object context

Do

if (!$object->getConditions()) {    return true;}


instead of

if (!$this->getConditions()) {    return true;}

because $this is non static.

Random ting

Select all products with no categories

SELECT e.entity_id, l.category_id FROM catalog_product_entity AS e LEFT JOIN catalog_category_product AS l ON l.product_id = e.entity_id WHERE l.category_id IS NULL

Update all of them... to have a category
http://magento.stackexchange.com/questions/41387/update-products-without-category
But does not work.

Idea...
Insert all catalog_product_entity.entity with NULL into catalog_category_product -> (category_id, product_id)

INSERT INTO catalog_category_product (category_id, product_id) VALUES(1,2),(4,5)



Fatal error: Call to a member function getCode() on a non-object in C:\wamp\www\stylepaste\app\code\core\Mage\Customer\Model\Session.php on line 71

do n98-magerun.phar local-config:generate
maybe and remember to import the database by using either phpmyadmin->(nameOfDatabase)->import 
or 
go into the install page. 


get out of vi:
esc -> : -> q

find declaration:
escapeHtml() by doing 
ctrl-f function escapeHtml(

nano ./onestepcheckout/helper/checkout 

set den til at være true



 * @var  Mage_Sales_Model_Order_Item $_item Kopi af dataer som har products
 * @var Mage_Catalog_Model_Product $_product products som er i DB (ændringer her sker også her).





søndag den 11. december 2011

HAN KAN FLYVE!!! og info

Fandt den for nyligt... synes I burde se den.
En gode måde at "afslutte" den sidste indlæg inden overførslen, synes I ik?