texts: Magento 2 Hardware Requirement confusion and Upgrading on Live server confusion

texts:
I have worked with Magento1 and Magento2 both.
But All of my Magento2 projects are hosted under dedicated server and the permission of Upgrading and Building using composer is given by the client. So there is no problem at all.

But right now i am working with a Magento2 project in which client has given me a VPS server. He will give the Upgrade and Build permissions but i have some questions of my own.

What is the correct Hardware Requirement for Magento2 in terms of RAM, HDD, Cores etc.
The most important question "Is is possible to build and setup-upgrade magento2 in local environment and upload the files to live server" like we use to do in Magento1. OR do e have to "setup-upgrade and Build" on the liver server compulsory.


texts: Back-End "Save and Continue Edit" Button Works Partially

texts:
I created a custom module and the "Save and Continue" button on the back-end grid edit page works partially. Either it saves the values and doesn't stay on the same (edit) page or it stays on the same page but doesn't save the values
(this happens when I uncomment the "setLocation" line in __construct() function).
How can I fix the button to both save the values and remain on the same page? Please help.

Here is the save action in controller file:

public function saveAction()
{
    //if (!$postData) return $this->getResponse()->setBody('$postData is empty');
    if ($postData = $this->getRequest()->getPost()) {
        $model = Mage::getSingleton('cpstest_productcomment/cps');
        $model->setData($postData);

        try {
            $model->save();

            Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The comment has been saved.'));

            if ($this->getRequest()->getParam('back', false)) {
                 $this->_redirect('*/*/edit', array(
                    'id' => $model->getId(),
                    '_current' => true
                ));
            } else {
                $this->_redirect('*/*/');
            }
            return;
        }
        catch (Mage_Core_Exception $e) {
            Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
        }
        catch (Exception $e) {
            Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while saving this comment.'));
        }

        Mage::getSingleton('adminhtml/session')->setCpsData($postData);
        $this->_redirectReferer();
    }
}


texts: Magento 2 : How to Check Cart Items Satisfying Cart Price Rule Condition?

texts:
In my module I have condition like cart price rule.
How to check item in cart satisfy condition or not.


texts: Magento 2.0 rollback to Magento 1.9x - question about attributes

texts:
Being a new magento "developer" (use quotes because honestly, I can barely navigate the admin let alone build this site properly!) I still have tons to learn. Recently tried to procure cheap hosting for a test site, and realized that the proper version of MySQL is still very uncommon and have not found hosting cheap enough that allows me to upgrade the MySQL version. That said, the plan now is to roll back to version 1.9.x so we can have a test host that mirrors the live host.

The main problem I am concerned about is not importing the products, but the categories, attributes and attribute sets. There are so many tables in Magento and I don't know which ones I need to export from the live version (which is currently running 2.x) and import to the new version (which will be 1.9.x)

Does anybody know which tables I need to port over after I install a fresh 1.9.x version and if there are any differences in the table structure to make sure I have all categories, attributes, and attribute sets ready on the new site so I can properly import all the products? THANKS IN ADVANCE and sorry if this question is too newbie!


texts:
I have an array with a list of products, and I wanna save each of its attributes in a table. Its a list of 25 products, but it saves the first product's attributes 25 times.
Here is my code:

$promo = Mage::getModel('novapc_allnations/promotion');
foreach ($return['response']['diffgrdiffgram']['NewDataSet']['Produtos'] as $product) {
    $promo->setName($product['DESCRICAO']);
    $promo->setIdProduct($product['CODIGO']);
    $promo->setPromoPrice($product['PRECOREVENDA']);
    $promo->setDescrtec($product['DESCRTEC']);
    $promo->setCategory($product['CATEGORIA']);
    $promo->setManufacturer($product['FABRICANTE']);
    $promo->setDepartment($product['DEPARTAMENTO']);
    $promo->setPartnumber($product['PARTNUMBER']);
    $promo->setEan($product['EAN']);
    $promo->setWarranty($product['GARANTIA']);
    $promo->setWeight($product['PESOKG']);
    $promo->setResalePrice($product['PRECOREVENDA']);
    $promo->setPriceWithoutSt($product['PRECOSEMST']);
    $promo->setExpireDate($product['DATAVALIDADEPRECO']);
    $promo->setAvailable($product['DISPONIVEL']);
    $promo->setPic($product['URLFOTOPRODUTO']);
    $promo->setStock($product['ESTOQUE']);
    $promo->setNcm($product['NCM']);
    $promo->setWidth($product['LARGURA']);
    $promo->setHeight($product['ALTURA']);
    $promo->setDepth($product['PROFUNDIDADE']);
    $promo->setActive($product['ATIVO']);
    $promo->setSubstTributaria($product['SUBSTTRIBUTARIA']);
    $promo->setProductOrigin($product['ORIGEMPRODUTO']);
    $promo->setAvailableStock($product['ESTOQUEDISPONIVEL']);
    $promo->setUpdatedAt($product['TIMESTAMP']);
    $promo->save();
}

Is there something wrong with my logic?


texts: Get the category thumbnails instead of image on sub category page

texts:
I am currently getting category image with the following code:

   <li class="item <?= $class ?> sub-cat-items">
       <a href="<?php echo $_category->getURL() ?>" title="<?php echo $this->
        htmlEscape($_category->getName()) ?>"><img src="<?php echo
        $_category->getImageUrl() ?>" width="580" alt="<?php echo
        $this->htmlEscape($_category->getName()) ?>" />

<?php echo
        $this->htmlEscape($_category->getName()) ?>

But i want to get thumbnail instead of main category image i have tried like this but not working:

       <?php
       $_categories = $this->getCurrentChildCategories();
        if ($_categories->count()):
        $categorycount = 0;
          foreach ($_categories as $_category):
           if ($_category->getIsActive()):
          $cur_category =  Mage::getModel('catalog/category')->load($_category->getId());
        $layer = Mage::getSingleton('catalog/layer');
        $layer->setCurrentCategory($cur_category);
        $catName = $this->getCurrentCategory()->getName();
        if ($categorycount == 0) {
            $class = "first";
        } elseif ($categorycount == 3) {
            $class = "last";
        } else {
            $class = "";
        }
      echo Mage::getModel('catalog/category')->load($cur_category)->getThumbnailImageUrl(). 'echo';
   ?>


texts: What tables contain customers + products information?

texts:
after a data migration problem (please check language translation and migration if interested on issue) I thought on alternatives.

a) Export csv with products + clients and reimport on clean install.

b) Export / import database tables that contain customer information + product information.

I'm gearing towards b for speed. What tables do I have to export + import?

Thanks.


texts: TCPDF ERROR: Unable to create output file in Magento2

texts:
I am trying to get PDF Download able, I installed TCPDF library by this:

composer require tecnickcom/tcpdf

and created PDF Document as:

// create new PDF document

$pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

Then created this function in block for testing and called in template:

public function testPdf(){

    $tcpdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    $tcpdf->SetCreator(PDF_CREATOR);

    $tcpdf->SetAuthor('Nicola Asuni');

    $tcpdf->SetTitle('TCPDF Example 001');

    $tcpdf->SetSubject('TCPDF Tutorial');

    $tcpdf->SetKeywords('TCPDF, PDF, example, test, guide');

// set default header data

    $Header_title = 'Sample PDF';

    $tcpdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . $Header_title, PDF_HEADER_STRING, array(0, 64, 255), array(0, 64, 128));

    $tcpdf->setFooterData(array(0, 64, 0), array(0, 64, 128));

// set header and footer fonts

    $tcpdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));

    $tcpdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

// set default monospaced font

    $tcpdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

// set margins

    $tcpdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);

    $tcpdf->SetHeaderMargin(PDF_MARGIN_HEADER);

    $tcpdf->SetFooterMargin(PDF_MARGIN_FOOTER);

// set auto page breaks

    $tcpdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

// set image scale factor

    $tcpdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

// set some language-dependent strings (optional)

    if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {

        require_once(dirname(__FILE__) . '/lang/eng.php');

        $tcpdf->setLanguageArray($l);

    }

// ---------------------------------------------------------

// set default font subsetting mode

    $tcpdf->setFontSubsetting(true);

//your htmls here

$html = '<h1> hello world </h1>';

// set some language dependent data:

    $lg = Array();

    $lg['a_meta_charset'] = 'UTF-8';

    $tcpdf->setLanguageArray($lg);

// set font

//dejavusans & freesans For Indian Rupees symbol

    $tcpdf->SetFont('freesans', '', 12);

    // remove default header/footer

//$tcpdf->setPrintHeader(false);

    $tcpdf->setPrintFooter(false);

    $tcpdf->AddPage();

    $tcpdf->writeHTML($html, true, false, true, false, '');

    $tcpdf->lastPage();

//$tcpdf->Output('report_per_route.pdf', 'I');

    $this->logger->debug('report_per_route');
    $baseurl = $this->_urlInterface->getBaseUrl();
    $filename = $baseurl . 'Sample_pdf'. time().'.pdf';
    $tcpdf->Output($filename, 'F');
    //$tcpdf->Output('report_per_route_'.time().'.pdf', 'I');

}

And geting this error:

TCPDF ERROR: Unable to create output file: http://localhost/magento_15/Sample_pdf1539345194.pdf

This error is due to baseurl as I firstly i was having this variable's error as undefined and then I asighn it localhost baseurl as seen in error.

If i do this with last part:

//$tcpdf->Output('report_per_route.pdf', 'I');

    $this->logger->debug('report_per_route');
    //$baseurl = $this->_urlInterface->getBaseUrl();
    //$filename = $baseurl . 'Sample_pdf'. time().'.pdf';
    //$tcpdf->Output($filename, 'F');
    $tcpdf->Output('report_per_route_'.time().'.pdf', 'I');

then this happens:

if do this with last part:

//$tcpdf->Output('report_per_route.pdf', 'I');

    $this->logger->debug('report_per_route');
    $baseurl = $this->_urlInterface->getDirPath();
    $filename = $baseurl . 'Sample_pdf'. time().'.pdf';
    $tcpdf->Output($filename, 'F');
    //$tcpdf->Output('report_per_route_'.time().'.pdf', 'I');

Then this warning comes:

how it should be handled rightly? Any help will be appreciated.


texts:
While browsing the code of magento 2.0.7's catalogrules module, i came accross a class Magento\CatalogRule\Model\Product\PriceModifier, Which was passed to Magento\Catalog\Model\Product\PriceModifier\Composite class as an argument via the di.xml of the catalogrules module.

Now the PriceModifier has a method named modifyPrice which takes existing price of the Product and modifies using its own mechanism and returns the new price.

I tried to test this functionality to check if it works by mimicking the same thing in my custom module, but the method is not called.

I tried to dig deeper into this and look at the Magento\Catalog\Model\Product\PriceModifier\Composite

<?php
/**
 * Composite price modifier can be used.
 * Any module can add its price modifier to extend price modification from other modules.
 *
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Catalog\Model\Product\PriceModifier;

use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\PriceModifierInterface;
use Magento\Framework\ObjectManagerInterface;

class Composite implements PriceModifierInterface
{
    /**
     * @var \Magento\Framework\ObjectManagerInterface
     */
    protected $objectManager;

    /**
     * @var array
     */
    protected $modifiers;

    /**
     * @param ObjectManagerInterface $objectManager
     * @param array $modifiers
     */
    public function __construct(ObjectManagerInterface $objectManager, array $modifiers = [])
    {
        $this->objectManager = $objectManager;
        $this->modifiers = $modifiers;
    }

    /**
     * Modify price
     *
     * @param mixed $price
     * @param Product $product
     * @return mixed
     */
    public function modifyPrice($price, Product $product)
    {
        foreach ($this->modifiers as $modifierClass) {
            $price = $this->objectManager->get($modifierClass)->modifyPrice($price, $product);
        }
        return $price;
    }
}

As we can see, the modifyPrice loops through all the modifiers, and calls their respective modifyPrice method and returns the modified price.

But the method is not called from any where. I need to know if this code is used from anywhere or is it just an unused code? And in case if it is not used, do we have any alternate mechanism to modify the price of product using similar approach? Any suggestion will be appreciated.


texts: Thumbs not showing in 'insert file' in admin

texts:
For backend - both in the 'Media Gallery' and 'insert file' the thumbs are not being shown.  Broken links are being shown.

I have tried resetting all the file and folder permissions - no change
I have tried enabling the WYSIWYG editor - no change
I have tried creating a WYSIWYG folder in the Media folder - no change

The images show on the frontend without any problems.  Using 2.3.5-p1 on Cloudways hosting.
I have added a picture and the code relating to one of the Thumbs..

 1491x965 px.
 washroom.jpg


texts: Getting this error when createCustomer mutation from graphql api (Some transactions have not been committed or rolled back)

texts:
I am getting this error when i try   createCustomer mutation from graphql api searched for solution for this error but reached nothing
i even tried to debug the code of module-customer-graph-ql in vendor by trying to log some variables values in system.log and got nothing from those variables trying to get their values ,
All i knew is that the error is coming from
Magento\Customer\Api\AccountManagementInterface  at this line
$customer = $this->accountManagement->createAccount($customerDataObject, $password);
Have been trying to know what is wrong with this part of the code but found nothing,
i will also mention that createcustomer mutation is working fine on the localhost on my pc but on the server it is giving me that mysterious error and also giving me server error on createCustomerToken mutation ,
But all functionality is working well in the front website of magento in the browser , magento version is magento2.3.2 on server and localhost

example mutation i am using for createCustomer

mutation{
  createCustomer(input: {
    firstname: "john"
    lastname: "doe"
    email: "john@doe.com"
    password: "!234Qwer"
  }){
    customer{
      email
    }
  }
}

error is here

  {
        "error": {},
        "text": "{\"errors\":[{\"message\":\"Internal server error\",\"category\":\"internal\",\"locations\":[{\"line\":2,\"column\":3}],\"path\":[\"createCustomer\"]}],\"data\":{\"createCustomer\":null}}\nFatal error:  Uncaught Exception: User Error: Some
  transactions have not been committed or rolled back in
  /home/admin/web/mywebsite/public_html/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php
  on line 3981 in
  /home/admin/web/mywebsite/public_html/vendor/magento/framework/App/ErrorHandler.php:61\nStack
  trace:\n#0 [internal function]:
  Magento\Framework\App\ErrorHandler->handler(256, 'Some
  transactio...', '/home/admin/web...', 3981, Array)\n#1
  /home/admin/web/mywebsite/public_html/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(3981):
  trigger_error('Some transactio...', 256)\n#2 [internal function]:
  Magento\Framework\DB\Adapter\Pdo\Mysql->__destruct()\n#3
  {main}\n  thrown in
  /home/admin/web/mywebsite/public_html/vendor/magento/framework/App/ErrorHandler.php
  on line 61\n"
      }


texts:
How to override block named "content" from page.xml? Am I doing it right? Cause below code not return expected value.

\app\code\local\Trening\NewModule\controllers\IndexController.php:

class Trening_NewModule_IndexController extends Mage_Core_Controller_Front_Action{
    public function sayHelloAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }

\app\code\local\Trening\NewModule\etc\config.xml:

<config>
    <frontend>
        <routers>
            <trening_newmodule>
                <use>standard</use>
                <args>
                    <module>Trening_NewModule</module>
                    <frontName>trening</frontName>
                </args>
            </trening_newmodule>
        </routers>
        <layout>
            <updates>
                <newmodule>
                    <file>trening.xml</file>
                </newmodule>
            </updates>
        </layout>
    </frontend>
</config>

\app\design\frontend\default\trening\layout\trening.xml:

<layout>
    <trening_newmodule_index_sayhello>
        <reference name="content">
                <block type="newmodule/product" name="newmodule" template="trening/myproducts.phtml" />
        </reference>
    </trening_newmodule_index_sayhello>
</layout>

\app\design\frontend\default\trening\template\trening\myproducts.phtml:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

<?php echo $this->getProducts(); ?>

\app\code\local\Trening\NewModule\Block\Product.php:

class Trening_NewModule_Block_Product extends Mage_Core_Block_Template
{
    public function getProducts()
    {
        return "it works!;";
    }
}

dashboard/admin/configuration/design Package_Name: rwd, Themes :blank


texts: Magento 2.3 After migration how to sync images from Magento 1.9 server?

texts:
How to sync images to Magento 2.3.3 from Magento 1.9.2.3 live server.

After successfully migrated Magento 2.3.3 from Magento 1.9.2.3 how to sync images from live Magento 1.9.2.3 server?


texts:
I want to customize the invoice PDF, so I believe I need to edit Magento 2 core files, please guide me how to achieve this task.

My purpose is customize the invoice PDF

Thanks


texts: Magento 2.1.8 - Custom Online shipping module not displaying shipping methods on checkout

texts:
I am creating a custom shipping module for magento 2.1.8.

I read on another post that shipping carriers divided into two types: online and offline shipping. (see How to programmaticlly create custom shipping method for third party API)

I seem to be having a problem with getting the shipping methods to display on the checkout with  online shipping. The reason i want to use online shipping is because i need to create a shipping label in the admin panel  when shipping the order, this functionality doesnt seem to be available with offline shipping.

I have tested the following code and the offline shipping code shows shipping methods on Checkout

Offline Shpping

use Magento\Shipping\Model\Carrier\AbstractCarrier;

class Carrier extends AbstractCarrier implements
\Magento\Shipping\Model\Carrier\CarrierInterface
{
   /**
    * Collect and get rates
    *
    * @param RateRequest $request
    *
    * @return bool|Result
    */
   public function collectRates(RateRequest $request)
   {
       /** @var \Magento\Shipping\Model\Rate\Result $result */
       $result = $this->_rateResultFactory->create();

       /** @var \Magento\Quote\Model\Quote\Address\RateResult\Method $method */
       $method = $this->_shippingRateMethodFactory->create();

       $method->setCarrier($this->_code);
       $method->setCarrierTitle($this->_title);

       $method->setMethod("Shipper");
       $method->setMethodTitle("My Shipping Method");

       $amount = 120;

       $method->setPrice($amount);
       $method->setCost($amount);

       $result->append($method);

       return $result;
    }
}

The following online shipping code doesnt show shipping methods on checkout

Online Shipping

use Magento\Shipping\Model\Carrier\AbstractCarrierOnline;

class Carrier extends AbstractCarrierOnline
implements \Magento\Shipping\Model\Carrier\CarrierInterface
{
   /**
    * Collect and get rates
    *
    * @param RateRequest $request
    *
    * @return bool|Result
    */
   public function collectRates(RateRequest $request)
   {
       /** @var \Magento\Shipping\Model\Rate\Result $result */
       $result = $this->_rateResultFactory->create();

       /** @var \Magento\Quote\Model\Quote\Address\RateResult\Method $method */
       $method = $this->_shippingRateMethodFactory->create();

       $method->setCarrier($this->_code);
       $method->setCarrierTitle($this->_title);

       $method->setMethod("Shipper");
       $method->setMethodTitle("My Shipping Method");

       $amount = 120;

       $method->setPrice($amount);
       $method->setCost($amount);

       $result->append($method);

       return $result;
    }
}

My problem is why is the shipping methods not displaying on checkout when i use the online shipping method code but it works fine with the offline code?

can someone hint me or guide in the right direction? Thanks


texts: Unable to add form in content section magento admin custom extension

texts:
I am working on magento admin. Try to adding grid with add edit action. But I am stuck at strange issue my form is display in left sidebar under selected tab. Don't know why this happen. Please help me if you know why this is happen

Code of XXXX/XXX/Block/Adminhtml/Dragon/Edit/Form.php

<?php

class XXXX_XXX_Block_Adminhtml_Dragon_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
{
  protected function _prepareForm()
  {
      $form = new Varien_Data_Form(array(
                                      'form_id' => 'edit_form',
                                      'action' => $this->getUrl('*/*/save', array('form_id' => $this->getRequest()->getParam('form_id'))),
                                      'method' => 'post',
                                      'enctype' => 'multipart/form-data'
                                   )
      );

      $form->setUseContainer(true);
      $this->setForm($form);
      $this->setTemplate('XXXX/form.phtml');
      return parent::_prepareForm();
  }
}


texts:
We are having trouble with managing products in admin in M2

When we go to a Product and press Save & Duplicate (so we can make a new product, and carryover most of the previous settings). It takes us to a blank page with plain text that says "product save after". And does not complete the action.

Also, when we use the Action dropdown to try and Delete a single product, (or any other action) -- We get HTTP 500 error.

Any thoughts?  Thank you for any input.


texts:
I have website maintenance mode and it allow open just homepage. It show errors when open example categories, products and admin dashboard, Error:

1 exception(s):
Exception #0 (Exception): Unable to proceed: the maintenance mode is enabled.

I run ssh command php bin/magento maintenance:enable --ip="my ip"

So how i can use fully website when is maintenance mode enabled? This is important so i can make website fixes. I want that customers cannot see/use website when there is maintenance.


texts: Rewrite function , when should I use local/mage and when shouldI use the rewrite by a module

texts:
I'm working on Magento 1.9

I can see I have 2 options to rewrite a mage file .
First, I just copy the file with the same path in local/mage/....
Second, I use a module and rewrite my method using etc/config.xml

Why there is 2 options ?
When should I use the first one , and when should I use the second one ?

Thanks for your answers


texts: Suggestions needed: Adding fake product to cart and bring it to order

texts:
I have a request to solve a problem and I wanted to ask if somebody has already faced a similar problem and got a good suggestion on how to go about implementing it.

We sell car parts (Auto parts) for BMW and there are about 1mio parts.
I don´t want to import all parts as products in the Magento 2 database and want to add like temporary products to the shopping cart, bring it to the order and maybe afterwards delete the product so I don´t fill my database with too much data.

The customer clicks through a form where he selects his car and then gets the parts suitable for his car, where he picks one part and adds this to the cart.
So I get the required data such as SKU, price, weight and so on from that external website by requesting them.

My Suggestions:

  Create a dummy product in Magento and always add this programmatically to the cart with new parts number, price, weight and
  so on, every time a customer puts something in the cart.
  Create a new full Magento product everytime the customer puts something in the cart and delete these newly created products after some
  days to keep the database clean. Products in orders stay, even if the
  products where deleted.

Does anyone have another good suggestion or experience with adding fake products in Magento 2?

Any ideas of side effects?


texts:
I'm using the code...

<?php echo $block->getBlockHtml('formkey') ?>

inside my custom phtml file but all I get is blank ''. I see this same code used throughout Magento Core.

How can I enable this functionality in my template?


texts:
I have a bunch of SKUs in a DB table and I want to get the respective products in my for each logic.

How to do it?


texts: Magento 2 moving cart page main title to columns section is not working

texts:
I've to move page title "Shopping Cart" into columns container/div.

So to do so in checkout_cart_index.xml file I've made changes.

app\design\frontend\mypackage\mytheme\Magento_Checkout\layout\checkout_cart_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="columns" htmlClass="columns container" />
        <move element="page.main.title" destination="columns" before="-" />
    </body>
</page>

But after flushing cache and all still title not moved.

Where Am I making mistake??


texts: Insert dynamic HTML block in product description

texts:
I would like to give my client the ability, in the backend, to insert in the product description some HTML blocks which have their classes and formatted style. My client has no knowledge of HTML and CSS, so I would like to give him the possibility to write just a short code to be parsed in the frontend to render the appropriate HTML.

The block i want to render is this:

        {label}
        {value}

the {label} and {value} should be replaced by the values specified in the shortcode my client should write in the product description:

[custom_block label="My label" value="My Value"]

Does Magento provide such a similar functionality or should I write something on my own?


texts:
I Have Doubt I want to use Same phtml file in another phtml but it won't work Because of $this

I want to know Why it's not working and How to use another phtml


texts: New orders are missing from admin when "Asynchronous indexing" is enabled

texts:
After enabling Asynchronous indexing new orders are missing from admin and Order Emails too not sending.

My cronjobs seems to be working just fine & I also tried to run the cron:run & setup:cron:run from the CLI but it didn't solve the issue

Any idea what might be the problem?

I know that I should expect delays when using the Asynchronous stuff but what's considered to be a normal delay?


texts: how to show attribute value for sorting in products list in magento

texts:
I have a attribute color which have value , red, green, blue, white, black and i want to show all these color value in product list page for sorting just like name and position.

Is there anyway to show these color value in product sorting in place of name and position.


texts: How to include the Login.php in my custom template? — Magento 2.2

texts:
I am new to Magento, I am not yet familiar with how the paths are working.
I am trying to override file Login.php the in the following path:

vendor/magento/module-customer/Block/Form/Login.php

I am trying to have a new copy in my custom template:app/design/frontend/Mine/CustomTemplate but I cannot find how to find the path in which I need to place the duplicated file, in order to override it.
Anybody has an idea about where the right path should be?

Thank you.


texts: Magento 1.9 : Custom option not work in product page

texts:
I have a product that has multiple prices
When I do not set the custom option, for example, 1400 will be displayed
But when I customize the option, the 1400 number becomes 1
But in the basket everything is right
This problem is only on the product page

[1] : https://pasteboard.co/It4NLeg.jpg
[2] : https://pasteboard.co/It4PfhFc.png

The purchase price of this product is 1000 when i add a custom option and add 1400, price of product changed to 10
Where can the problem be?


texts: Credit Memo Return to stock is not working

texts:
When I use the credit memo to refund customer and return the qty to stock the qty is not being returned to stock.

E.g. I have 1 hat instock I sell the hat and the qty changes to 0 and status to out of stock. However when I do a return to stock via credit memo the qty stays at 0 and status out of stock. It will not update the stock when a return is made.

How do I fix this?


texts: Can we create single composer file for more then 1 module

texts:
I am creating one module which will contain more then 1 module in it. Is it possible to create single composer file for more then 1 module?

Please let me know is it possible or not. If yes, then it will be more helpful if you can tell me how.


texts: Magento2 : How to add a custom option to Item in cart

texts:
I have product with a custom option.

On the event checkout_cart_product_add_after, I want to assign to this option some value programmatically.
If the option has been set by the customer in product page, I manage to do it using :

$this->_cart->getquote()->getItemById($item->getItemId())->getOptionByCode('option_'.$OptionID)->setValue($foo)->save();

But in the case the option has not been set by customer in product page, the cart item does not have this option. I then need to create it, but I do not manage to do it.

NB: I can retreive the product options using :

$ProductId=$item->getProduct()->getId();
$Product=$this->_productRepository->getById($ProductId);
$Options=$Product->getOptions();

Thank you for your help


texts: Renderer function not work in magento grid

texts:
I don't know what is the problem with my code.

Gird

    $this->addColumn('category', array(
                'header'    => Mage::helper('udropship')->__('Cateogry'),
                'index'     => 'category',
                'sortable'  => false,
                'filter'    => false,
                'renderer'  => 'Unirgy_DropshipPo_Block_Adminhtml_ReportItem_Bundle',
));

Renderer Function

class Unirgy_DropshipPo_Block_Adminhtml_ReportItem_Bundle extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
    public function render(Varien_Object $row)
    {
        return "work";
    }
}


texts:
I have a website built on magento 1.9.3.x , when I test my website on tools.pingdom , it gave me a TTFB of over 10 sec.

How can we optimize this time to speed up the performance of the site.

Thank you.


texts: minfied javascript but in gtmetrics says it is not minified

texts:
I have minified javascript through store->advance->developer .
i also tried it using database query .
but gtmetrics shows javascript is not verified . what are the possible issues ?
all commands are done , var/static folder delete , var/cache delete , var/view_preprocessed empty . what is the issue ?


texts:
I am using  Magento ver. 2.1.7 CE .

I added new button "Validate" in UI component layout as follows

<item name="buttons" xsi:type="array">
<item name="print" xsi:type="array">
    <item name="name" xsi:type="string">print</item>
    <item name="label" xsi:type="string" translate="true">Validate</item>
    <item name="sortOrder" xsi:type="number">0</item>
    <item name="class" xsi:type="string">primary</item>
    <item name="url" xsi:type="string">*/*/save</item>
</item>
<item name="add" xsi:type="array">
    <item name="name" xsi:type="string">add</item>
    <item name="label" xsi:type="string" translate="true">Add New</item>
    <item name="class" xsi:type="string">primary</item>
    <item name="url" xsi:type="string">*/*/add</item>
</item></item>

I want to validate the checkbox for limit the selection not more than two items before submission.

If more than two selection, show popup message to user.

Thanks.


texts:
<sales_email_order_items>
    <block type="sales/order_email_items" name="items" template="email/order/items.phtml">
        <action method="addItemRender"><type>default</type><block>sales/order_email_items_order_default</block><template>email/order/items/order/default.phtml</template></action>
        <action method="addItemRender"><type>grouped</type><block>sales/order_email_items_order_grouped</block><template>email/order/items/order/default.phtml</template></action>
        <block type="sales/order_totals" name="order_totals" template="sales/order/totals.phtml">
            <action method="setLabelProperties"><value>colspan="3" align="right" style="padding:3px 9px"</value></action>
            <action method="setValueProperties"><value>align="right" style="padding:3px 9px"</value></action>
            <block type="tax/sales_order_tax" name="tax" template="tax/order/tax.phtml">
                <action method="setIsPlaneMode"><value>1</value></action>
            </block>
        </block>
    </block>
    <block type="core/text_list" name="additional.product.info" />
</sales_email_order_items>

While searching for the email templates for an order I found this block of the XML file. It clearly specifies which template files are used.
My question is for product type default one can easily find the template file by seeing the addItemRender method and type=default.

But for product type="grouped" the template file that is shown is /email/order/items/order/default.phtml but in actual /bundle/email/order/items/order/default.phtml is the template file. It will sound silly but any one could let me know why the bundle is not specified in the template path hint, if it is understood by default then how?

And also blocks
sales/order_email_items_order_grouped
and this
sales/order_email_items_order_default
where I could find them and what is their use.


texts:
I am trying to access the details of product in JSON format.
I need to store details in JSON file as I am going to use this JSON file.
Following is my code.

Mage::app('default');
$productId = 35;
$product = Mage::getModel('catalog/product')->load($productId);
echo json_encode($product);
var_dump(json_decode($product));
exit;

But following result is displayed

{}NULL

Please help..


texts: Calling Associated product images in configurable product

texts:
Hi i'm using this magento wiki to  Change Product Image on View Page to Associated Product's Image.

Now when i select any attribute only base image gets changed. All other multiple images remains the same original product's one.

Is there any way to change original image list to associated product images.


texts: Insert a miniform on adminhtml order view page right above order items

texts: I'm trying to find a way of inserting a small form into the adminhtml sales order view page, right above the order items block, without intervening in the template file. So, basically, is there a way of doing that exclusively via layout XML?


texts:
I have disabled this part from newsletter.xml

<reference name="left">
  <block type="newsletter/subscribe" name="left.newsletter" template="newsletter/subscribe.phtml"/>
</reference>

and directly using this part  in the header

<form action="<?php echo $this->getFormActionUrl() ?>" method="post" id="newsletter-validate-detail">
                                        <input type="text" name="email" id="newsletter" title="" class="input-text required-entry validate-email" />
<button type="submit" title="<?php echo $this->__('Join') ?>" class="button">
JOIN
</button>
</form>

from the code of subscribe.phtml. But it does't subscribe email. Whats wrong or is that a SMTP problem?


texts: Magento 2 error: definition specified by xsi:type is blocked

texts:
I am trying to create my custom widget and I have my widget.xml file like:

<?xml version="1.0"?>
<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Magento/Widget/etc/widget.xsd">
<widget id="WidgetId" class="WidgetClass">
    Widget label
    <parameters>
        <parameter name="firstParameter" xsi:type="string" required="true" visible="true" sort_order="0" >
            First parameter label
        </parameter>
        <parameter name="secondParameter" xsi:type="number" required="true" visible="true" sort_order="1" >
            Second parameter label
        </parameter>
    </parameters>
</widget>

And now I got an error:

The type definition 'string', specified by xsi:type, is blocked or not validly derived from the type definition of the element declaration.

Could someone tell me why it shows and how to solve it?


texts:
We have a website and its working perfectly fine. We want to block users so they can't login into our admin section.

We have one public IP in our factory premises to access the internet and we locally make server to access the internet on other computers.

We want our website admin login section only accessibly within factory premises and no one can access the admin login section out of the factory or only specific registered user can login into admin section out the factory as well like our CEO and our project manager.

is this feature possible in Magento 1.9.2.3?

Hope you people understand my problem.

thanks


texts: Customizing error report page for multi site

texts:
I have 3 stores with subdirectory method.
I customized error page and this shows properly on the main store A.
However, store B and C (which are on sub directories) do not show customized one and instead showing the default one.

In my local.xml under errors folder, I have

<config>
    <skin>mytheme</skin>
    <report>
        <action>email</action>
        <subject>Store Debug Information</subject>
        <email_address>my@email.com</email_address>
        <trash>leave</trash>
    </report>
</config>

and index.php under store B and C subdirectory have

if (file_exists($maintenanceFile)) {
    include_once dirname(__FILE__) . '/../errors/503.php';
    exit;
}

What could be the reason??

I also see on the browser that store B, for example, is trying to load style.css from mystore.com/en/errors/default/css/styles.css
which should be mystore.com/errors/mytheme/css/styles.css


texts: Duplicate url rewrite for the same product_id

texts:
i'm new on magento developement.
My "core_url_rewrite" datatable contains 3.000.000 records for 3.000 products.

For a given target_path, i have 1000 records but i dont known why

Please help. thanks


texts:
How to Implement massactions in grid using ui_component magento2. I have created my ui_component and need to implement massactions. I have also created controllers for the required paths. But, somehow it is just not working. I'm using magento 2.1 C.E.

ui_component/test_grid.xml

<massaction name="listing_massaction">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="selectProvider" xsi:type="string">test_grid.test_grid.test_grid_columns.ids</item>
            <item name="component" xsi:type="string">Magento_Ui/js/grid/tree-massactions</item>
            <item name="indexField" xsi:type="string">entity_id</item>
        </item>
    </argument>
    <action name="accept">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="type" xsi:type="string">accepted</item>
                <item name="label" xsi:type="string" translate="true">Accept</item>
                <item name="url" xsi:type="string">test/Index/Massaccept</item>
            </item>
        </argument>
    </action>
</massaction>

Index/Massaccept.php

<?php
    namespace Vendor\Module\Controller\Adminhtml\Index;
    use \Vendor\Module\Model\TestFactory;

    class Massaccept extends \Magento\Backend\App\Action {

        protected $resultPageFactory = false;
        protected $_fasctcureFactory;

        public function __construct(
            TestFactory $testFactory,
            \Magento\Framework\View\Result\PageFactory $resultPageFactory,
            \Magento\Backend\App\Action\Context $context
            ) {
            $this->_testFactory = $testFactory;
            $this->resultPageFactory = $resultPageFactory;
            parent::__construct($context);
        }

        public function execute() {
            die("working");
            $ids = $this->getRequest()->getParam('id');
            $model = $this->_testFactory->create();

            foreach($ids as $id) {
                $model->load($id);
                $model->getStatus();
                $model->setStatus('Processing');
                $model->save();
            }
            $resultRedirect = $this->resultRedirectFactory->create();
            $resultRedirect->setRefererOrBaseUrl();
            return $resultRedirect;
        }
    }

My controllers are in the path:

Vendor/Module/Controller/Adminhtml/Index/Massaccept.php
Vendor/Module/Controller/Adminhtml/Index/Massreject.php

The mass actions are visible on the grid, but are not redirecting anywhere.Redirect is not working for using above code.

All I'm getting is this error:

Uncaught TypeError: Cannot read property 'total' of undefined in massactions.js:52


texts: Magento 2.0.0, very slow, paths not good

texts:
I installed magento 2.0.0 on my computer. OS: Windows 10
I downloaded ZIP archive with sample data from:   https://www.magentocommerce.com/download. Also, followed installation instructions from their documentation, I ran composer install, and after that, the installation was complete, successfully.

Firstly, it is very, very slow. Is this common behaviour for my OS, and similar?

Also, there are lots of files, images, etc for which the path is not good, and GET returns HTTP 404. Am I missing something important here?


texts: Use ::class notation instead warning while checking code in Magento 2 coding standard

texts:
I am accessing block function in phtml like

$blockObj= $block->getLayout()->createBlock('Esparksinc\Extension\Block\Product\View');

but this gave Waring of class notation instead while cheqing code during coding standarded.


texts: How to add shipment numbers to sales_order_grid column?

texts:
So, question is: how can i correctly add column with shipment numbers from

to sales order grid table?
Currently i made it with plugin but there're several issues:

got an error at order's shipment tab:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'order_id' in 'where clause', query was: SELECT COUNT(*) FROM `sales_order_grid` AS `main_table` WHERE (`order_id` = '5') AND (`order_id` = '5') AND (`order_id` = '5')

got just 12 orders instead of ~100

plugin:

public function __construct(MessageManager $messageManager,
    SalesOrderGridCollection $collection
) {

    $this->messageManager = $messageManager;
    $this->collection = $collection;
}

public function aroundGetReport(
    \Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory $subject,
    \Closure $proceed,
    $requestName
) {
    $result = $proceed($requestName);
    if ($requestName == 'sales_order_grid_data_source') {
        if ($result instanceof $this->collection
        ) {
            $select = $this->collection->getSelect();

            $select->joinRight(
            ['sst' => 'sales_shipment_track'], "main_table.entity_id = sst.order_id");

            $select->joinRight(
                                'sales_shipment_track',
                                'main_table.entity_id = sales_shipment_track.order_id',
                                array(
                                    'numbers'  => new \Zend_Db_Expr('group_concat(`sales_shipment_track`.track_number SEPARATOR ",")')
                                )
                            );

            $select->group('main_table.entity_id');

        }

    }

    return $this->collection;
}

}

di.xml:

<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<plugin name="sales_order_additional_columns" type="Namespace\Module\Plugin\AddColumnsSalesOrderGridCollection" sortOrder="100" disabled="false" />

and sales_order_grid.xml:

<column name="track_number">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="label" xsi:type="string" translate="true">Track numbers</item>
                <item name="sortOrder" xsi:type="number">252</item>
                <item name="align" xsi:type="string">right</item>
                <item name="filter" xsi:type="string">text</item>
                <item name="visible" xsi:type="boolean">true</item>

            </item>
        </argument>
    </column>

Thanks in advance.


texts:
I got error in custom module. I am getting error like this:

Fatal error: Class 'Test_log_Adminhtml_Block_Log' not found in app/code/core/Mage/Core/Model/Layout.php on line 491

How to fix this?
xml file

        <blocks>
        <log>
            <class>Test_log_Block</class>
        </wsalogger>
       <log_adminhtml>
            <class>Test_log_Adminhtml_Block</class>
        </log_adminhtml>
    </blocks>


texts: API POST confirmation from third party Payment Gateway not processed by Magento 2 API

texts:
We have built a standard API system to handle a POST API call from a third party payment gateway.  I can see that Magento receives the API call from the third party to webapi.xml, but it does not process it.  Can someone please see where we are going wrong?

webapi.xml

<?xml version="1.0"?>
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../app/code/Magento/Webapi/etc/webapi.xsd">
    <route method="GET" url="/V1/infy-qrcode/post">
        <service class="Infy\Qrcode\Api\StatusInterface" method="getPost"/>
        <resources>
            <resource ref="anonymous"/>
        </resources>
    </route>
</routes>

StatusInterface.php

<?php
namespace Infy\Qrcode\Api;

interface StatusInterface
{
    /**
     * Returns
     *
     * @param mixed $ordernum
     * @param mixed $greenpay_id
     * @return mixed
     */
    public function getPost($ordernum, $greenpay_id);
}

Status.php

<?php

namespace Infy\Qrcode\Model\Api;
use Magento\Sales\Model\Order;
use Infy\Qrcode\Helper\Data;

class Status implements \Infy\Qrcode\Api\StatusInterface
{
    //return @param string
    const STATE_PAYMENT_VERIFIED = 'payment verified';
    public function getPost($ordernum, $greenpay_id)
    {

        //$helper = $helper_factory->get('\Infy\Qrcode\Helper\Data');

        try {
            //get payment object from order object
            //processing happens here

            $logFile = fopen("apitestlog.txt", "w") or die("unable to open log file.");
            $logText = "api returned ok\n";
            fwrite($logFile, $logText);
            fclose($logFile);

        }
    }

}

I have written a basic PHP script that i have run outside of Magento and this all works as expected;

ApiTest.php

<?php

    $merchToken = "20nqonb5pidsgsdfsdgdfg";
    $greenpay_id = $_POST["greenpay_id"];
    $ordernum = $_POST["ordernum"];
    $account = $_POST["account"];
    $amount = $_POST["amount"];
    $realamount = $_POST["realamount"];
    $type = $_POST["type"];
    $orderuid = $_POST["orderuid"];
    $key = $_POST["key"];

    $logFile = fopen("log.txt", "w") or die("unable to open log file.");
    $logText = "----------------------".date('Y-m-d H:i:s')."----------------------\n";
    fwrite($logFile, $logText);
    $logText = "greenpay_id:".$greenpay_id."\n";
    fwrite($logFile, $logText);
    $logText = "ordernum:".$ordernum."\n";
    fwrite($logFile, $logText);
    $logText = "amount:".$amount."\n";
    fwrite($logFile, $logText);
    $logText = "realamount:".$realamount."\n";
    fwrite($logFile, $logText);
    $logText = "account:".$account."\n";
    fwrite($logFile, $logText);
    $logText = "type:".$type."\n";
    fwrite($logFile, $logText);
    $logText = "orderuid:".$orderuid."\n";
    fwrite($logFile, $logText);
    $logText = "key:".$key."\n";
    fwrite($logFile, $logText);

    $orderStr = md5($ordernum . $orderuid . $greenpay_id . $amount . $realamount . $type . $merchToken);

    $logText = "local md5 str:".$orderStr."\n";
    fwrite($logFile, $logText);

    fclose($logFile);

    if ($orderStr != $key){
        echo 'Success';
    } else {
        echo 'Fail';
    }

?>

EDIT: I have written a CURL script to simulate the API from the payment gateway.  I am receiving Request does not match any route.

However if i access https://mag.website.co.uk/rest/V1/infy-qrcode/post in a web browser it gives me an error that fields are missing.  If I access it through CURL then i get the above error.


texts:
Today I installed a fresh magento CE 1.9.2 onto a dedicated server (1and1) and ran into an error that I cant get passed.

The initial error is "Exception printing is disabled by default for security reasons.  Error log record number: XXXXXXXXXXX". After looking at the error code, I found that "Base table or view not found or doesn't exist"

  Error in file: "app/code/core/Mage/Poll/data/poll_setup/data-install-1.6.0.0.php" - SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db583671866.poll' doesn't exist, query was: DESCRIBE poll

  Trace:

  0 app/code/core/Mage/Core/Model/Resource/Setup.php(645): Mage::exception('Mage_Core', 'Error in file: ...')

  1 app/code/core/Mage/Core/Model/Resource/Setup.php(391): Mage_Core_Model_Resource_Setup->_modifyResourceDb('data-install', '', '1.6.0.1')

  2 app/code/core/Mage/Core/Model/Resource/Setup.php(289): Mage_Core_Model_Resource_Setup->_installData('1.6.0.1')

  3 app/code/core/Mage/Core/Model/Resource/Setup.php(269): Mage_Core_Model_Resource_Setup->applyDataUpdates()

  4 app/code/core/Mage/Core/Model/App.php(362): Mage_Core_Model_Resource_Setup::applyAllDataUpdates()

  5 app/Mage.php(684): Mage_Core_Model_App->run(Array)

  6 index.php(83): Mage::run('', 'store')

  7 {main}

Other people have had this problem and I've read all the other topics on this but it was a different table that missing so adding their fix wouldn't help. What is the best way to troubleshoot this? Or does anyone know how to fix the issue?


texts: I am not sure if what I see in admin it is right. I mean, why shouldn't be there customer notified status? This is the first time I am using Authorize and I don't have any idea if it related to this. The thing is that I am expecting to see that the customer was notified. Ignore Transaction ID "0" for test purpose because the same happens on live.


texts: SUPEE-10266 cannot be applied to Magento 1.9.1.1

texts:
I am experiencing issues patching the new SUPEE 10266 on a fresh Magento 1.9.1.1.

Getting the following error. Not sure if this is the correct place to report it.

Patching a fresh 1.9.1.1 with all previous related patches applied.

sh PATCH_SUPEE-10266_CE_1.9.1.1_v1.sh
Checking if patch can be applied/reverted successfully...
ERROR: Patch can't be applied/reverted successfully.

can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git app/code/core/Enterprise/CustomerSegment/controllers/Adminhtml/CustomersegmentController.php app/code/core/Enterprise/CustomerSegment/controllers/Adminhtml/CustomersegmentController.php
|index d44ecac..36d3f39 100644
|--- app/code/core/Enterprise/CustomerSegment/controllers/Adminhtml/CustomersegmentController.php
|+++ app/code/core/Enterprise/CustomerSegment/controllers/Adminhtml/CustomersegmentController.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
checking file app/code/core/Mage/Admin/Model/Session.php
checking file app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Websites.php
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored
checking file app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Notice.php
checking file app/code/core/Mage/Adminhtml/Block/Notification/Window.php
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored
checking file app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php
checking file app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php
Hunk #1 FAILED at 49.
1 out of 1 hunk FAILED
checking file app/code/core/Mage/Adminhtml/Controller/Action.php
Hunk #1 succeeded at 51 (offset 8 lines).
Hunk #2 succeeded at 169 (offset 8 lines).
Hunk #3 succeeded at 186 (offset 8 lines).
Hunk #4 succeeded at 407 with fuzz 2 (offset -37 lines).
checking file app/code/core/Mage/Adminhtml/controllers/CustomerController.php
checking file app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php
Hunk #1 succeeded at 63 with fuzz 2.
checking file app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php
checking file app/code/core/Mage/Checkout/controllers/CartController.php
Hunk #1 FAILED at 236.
Hunk #2 succeeded at 683 with fuzz 2 (offset 262 lines).
1 out of 2 hunks FAILED
checking file app/code/core/Mage/Rss/Helper/Data.php
Hunk #1 FAILED at 34.
Hunk #2 FAILED at 60.
2 out of 2 hunks FAILED
checking file app/code/core/Mage/Sales/Model/Mysql4/Order/Item/Collection.php
Hunk #1 FAILED at 121.
1 out of 1 hunk FAILED
checking file app/code/core/Zend/Serializer/Adapter/PhpCode.php
checking file app/design/adminhtml/default/default/template/catalog/product/edit/options/type/file.phtml
Hunk #1 FAILED at 31.
1 out of 1 hunk FAILED
checking file app/design/adminhtml/default/default/template/customer/tab/view.phtml
checking file app/design/adminhtml/default/default/template/login.phtml
Hunk #1 FAILED at 55.
1 out of 1 hunk FAILED
checking file app/design/adminhtml/default/default/template/notification/toolbar.phtml
Hunk #1 FAILED at 80.
1 out of 1 hunk FAILED
checking file app/design/adminhtml/default/default/template/sales/order/view/history.phtml
checking file app/design/adminhtml/default/default/template/sales/order/view/info.phtml
Hunk #1 succeeded at 130 (offset 1 line).
checking file app/design/install/default/default/template/install/create_admin.phtml
checking file downloader/template/login.phtml
Hunk #1 succeeded at 35 (offset 1 line).


texts: Add products which have a catalog price rule to a specific category

texts:
I got 11 different catalog price rules set up in my Magento 1.9.3 store and I've got a script randomly activating one of the price rules every day with a cronjob.

Now I want to add the products which have a catalog price rule activated to a specific category so I will have 'Day deals' which are randomly selected every day.

I'm no expert at all in coding but by googling I came up with this:

To clear the category of products first:

    <?php
require_once 'app/Mage.php';
Mage::app();

$category = Mage::getModel('catalog/category')->load(846);
$category->setPostedProducts(array());
$category->save();

?>

And to add the products in the category:

    <?php
require 'app/Mage.php';

$category_id = 846;
$resource = Mage::getSingleton('core/resource');
$connection = $resource->getConnection('core_read');
$tableName = $resource->getTableName('catalogrule_product');
$productIdList = $connection->fetchAll('SELECT product_id FROM '.$tableName.'');

foreach ($productIdList as $productId) {
    $product = $productId['product_id'];

Mage::getSingleton('catalog/category_api')
            ->assignProduct($category_id,$product);
            }
            ?>

Unfortunately, it isn't working. What should I do to make this work?

** FIX UPDATE **

The second script needed

require_once 'app/Mage.php';


texts: Magento 2 custom attribute value returns "No"

texts:
I'm trying to get custom attribute value by using:

$_product->getResource()->getAttribute('attribute_code')->getFrontend()->getValue($_product);

however I keep getting "No" as actual value, no matter which custom attribute I'm trying to get, it all returns "No", include both simple and configurable products.

I also tried to get the label and it returns the correct label:
$_product->getResource()->getAttribute('attribute_code')->getFrontend()->getLabel()

What have I done wrong?


texts: 404 Page - Front controller reached 100 router match iterations

texts:
In a fresh install of Magento Community Edition 1.9.2.2, if I try to hit a 404 page (wrong url) I get a Magento Exception, instead of the regular CMS No Route page.

Example URL: https://www.example.com/wrong-url

Report:

a:5:{i:0;s:52:"Front controller reached 100 router match iterations";i:1;s:456:"#0 /var/www/vhosts/example.com/app/code/core/Mage/Core/Controller/Varien/Front.php(179): Mage::throwException('Front controlle...')
#1 /var/www/vhosts/example.com/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#2 /var/www/vhosts/example.com/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#3 /var/www/vhosts/example.com/index.php(83): Mage::run('default', 'store')
#4 {main}";s:3:"url";s:10:"/wrong-url";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}

In the Magento dashboard > System > Configuration > Web > Default pages, the CMS No Route Page is set to an existing page.

The Mage_Cms module is enabled.

No exceptions are logged in exception.log

We use nginx + php-fpm.

I already checked What is the cause of "Front controller reached 100 router match iterations" error? and the information in https://github.com/convenient/magento-ce-ee-config-corruption-bug#update-2-further-improvements.


texts: Product Page Error Magento 1.9. and PHP7

texts:
I am looking to move a magento site to PHP7, and whilst the site generally seems fine, there is an issue with the product page. It loads half the page and then throws an error:

Fatal error:  Uncaught TypeError: Argument 1 passed to
Mage_Catalog_Helper_Image::init() must be an instance of Mage_Catalog_Model_Product, null given, called in /home/xxx/public_html/app/design/frontend/default/MAG090173/template/catalog/product/view/media.phtml on line 74 and defined in /home/xxx/public_html/app/code/core/Mage/Catalog/Helper/Image.php:143
Stack trace:

-#0 home/xxxx/public_html/app/design/frontend/default/MAG090173/template/catalog/product/view/media.phtml(74): Mage_Catalog_Helper_Image-&gt;init(NULL, 'image', '/a/p/apple_juic...')

-#1 /home/xxxx/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/xxx...')

-#2 /home/xxx/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template-&gt;fetchView('frontend/defaul...')

-#3 /home/xxxx/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template-&gt;renderView()

-#4 /home/xxxx/public_html/app/code/core/Mage/Core/Block/Abstract.php in /home/xxxx/public_html/app/code/core/Mage/Catalog/Helper/Image.php on line 143

Any suggestions?

I have now tracked the issue down to the following code in the template file:

I think I have tracked the issue down to the following code in the tenmplate:

<a href='<?php echo $this->helper('catalog/image')->init($product, 'image', $_image->getFile())->resize(600,600);?>' class='cloud-zoom-gallery lightbox-group' title='<?php echo $this->escapeHtml($_image->getLabel()) ?>' rel="useZoom: 'zoom1', smallImage: '<?php echo $this->helper('catalog/image')->init($product, 'image', $_image->getFile())->resize(300,300);?>' ">
<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(74); ?>" width="74" height="74" alt="<?php echo $this->escapeHtml($_image->getLabel()) ?>" />

I am guessing something here is not PHP7 compliant.

Any suggestions? what it might be


texts: Magento 2 how to override the special price

texts:
all can you help me how to override a product's special price? I want to unset Special Price if that product does not meet my condition.

I was able to override Price to my custom value, but if there is any special price exists for that product, then the special price is showing so I can't set my custom price for that product.


texts: I want to make an option compulsory on my registration page

texts:
I want to make the option "i found kiabza through" compulsory on my registration page, so that is everyone has to fill it when they register. Also this option was added as a custom addon by our developer, but since they have left i need your help to figure this problem. For your reference i have added the link and screenshot below. Thanks
https://www.kiabza.com/customer/account/create/


texts: doing topsellers/bestsellers by category elegantly

texts:
So I've been tasked with making a bestsellers box, yet I've heard a horror story about the bestsellers box in a previous site taking down the site because of the extensive load.

First, I should mention that this site has quite a bit of products, somewhere in the thousands or ten thousands.

Ive seen extensions and code snippets that do bestsellers, and it seems to make use of something like this:

$collection = Mage::getResourceModel('reports/product_sold_collection')
                            ->addOrderedQty()
                            ->setStoreId($storeId)
                            ->addStoreFilter($storeId)
            ->setDateRange($sellDate['startdate'],          $sellDate['todaydate']) //
                            ->addUrlRewrite()
                            ->setOrder('ordered_qty', 'desc')
                            ->setPageSize($this->getModel()->getHomepageProductsLimit())
                            ->setCurPage(1)
            ->setOrder('ordered_qty', 'desc');

I looked into that and it seems like whats going on is that its going through all the products, and getting ordered_qty from those products.

I also noticed that there were some cool tables called sales_bestsellers_aggregated_monthly /  sales_bestsellers_aggregated_daily / sales_bestsellers_aggregated_weekly that get populated by a cron task.

I thought it would be cool to make use of these tables, but the problem with that is A) there is no category data and B) its monthly/daily/weekly rather than all time.   That latter may not be such an issue, but its something to be considered.

I guess what I am looking for is some thoughts on how to approach this in a way where its not going to take down the site.   The site will be behind varnish, but I heard even behind varnish, the last site was taken down by bestsellers.

Thanks!


texts: Magento 2 sometimes don't show items in the second category

texts:
I have two basic categories (woman/man) with many subcategories and products. Sometimes, just sometimes the products in the second category "man" don't appear in the frontend. In the backend they are still there.

Often after I do php bin/magento indexer:reindex the products still missing the first time and if I do it again they will be there.

My Magento Version is 2.1.1


texts: Magento 2.2.2 add to cart not working after server change

texts:
Add to cart was not working on local server and it was fixed by changing the base_url in database from "http://localhost/magento2" to "http://127.0.0.1/magento2".

Now after all design changes when this installation was moved to live server, we made the respective changes in DB, env.php and cleared cache.

Every link and all functionalities are working fine except 'Add to cart' functionality has stopped working.

Following are the issues with 'Add to cart':

On category page (product listing page): when 'Add to cart' button is clicked, it directly takes to 'cart' page without adding product to cart.
On Product detail page: When clicked on 'Add to cart' button, its text changes to 'Adding' and it stays the same and product is never added to cart.

There are no errors in console for both of the above scenarios.

Following I have tried:

Deleted following directories:

pub\static
var\cache
var\page_cache
var\view_preprocessed
var\composer_home

Ran these commands using ssh:

php bin/magento setup:static-content:deploy
php bin/magento indexer:reindex

And following commands to give magento's default permissions to directories:

sudo chmod -R a+wX pub
sudo chmod -R a+wX var
sudo chmod -R a+wX app
sudo chmod -R a+wX app/etc
sudo chmod -R a+wX generated

Updated cookie_lifetime to 86400 in admin.

Cleared cache from admin.

But still issue persists.

Please help in resolving this.


texts:
I have setup my custom theme and using Magento 2 Blank theme as the parent theme <parent>Magento/blank</parent>

I like the Luma icons more. How do I add the Luma icons in my custom theme?
The Luma homepage have styles for the content-heading. Where/in
which less file are those styles added in the Luma theme? And what
are best practices to add those to my own custom theme?
I want to style the wishlist, compare and email links (below tocart
button) on the productview page exactly like Luma theme. I see in
/vendor/magento/theme-frontend-luma/Magento_Catalog/web/css/source/_module.less
those styles. Do I have to copy those styles over to
/app/design/frontend/Vendor/theme/web/css/source/_theme.less? Or is
there a better/other preferred way to do it?
I want to style the tabs on the productview page exactly like Luma
theme. So it has a border around it? Where are those less styles in
Luma theme and where do I have to add those styles?

Update:

If you look at Luma's <div class="panel wrapper">, they added a
background-color. What is the preferred way to add this class and
it's variable to my custom theme? (I know in Luma theme it's living
in
/vendor/magento/theme-frontend-luma/Magento_Theme/web/css/source/_module.less.
But how do I get this in my own theme? What is the preferred
workflow?


texts: I like to add a quantity drop-down In cart page

texts:
I need to add quantity drop-down In cart page

Customer are able to change quantity by changing drop down option


texts: Bit masking model attributes: Yeah or Nay?

texts:
I would like to know if bit masking a attribute in a model is good practice. To me it makes sense: Low database usage and fast extraction of the data. Maybe I'm overseeing something, so I would like to know your opinion!

<?php

class Test_Module_Model_Slider extends Mage_Core_Model_Abstract {

  const TEMPLATE_DEFAULT = 0;
  const TEMPLATE_TWO_AT_ONCE = 1;

  const NAVIGATION_BULLETS_ENABLED = 0;
  const NAVIGATION_ARROWS_ENABLED = 2;
  const NAVIGATION_ARROWS_HIDE_AUTO = 4;
  const NAVIGATION_ARROWS_REMOVE_ON_TOUCH = 8;

  protected $_eventPrefix = 'test_module_slider';

  protected $_eventObject = 'slider';
  protected $_slides = array();
  protected $navigationOptions = 0;

  public function _construct() {
    $this->_init('test_module/slider');
  }

  public function getSlideCollection() {
    $slideCollection = Mage::getModel('test_module/slide')->getCollection();
    $slideCollection->addFilter('slider_id', $this->getId());
    return $slideCollection;
  }

  public function setBulletsEnabled($value) {
    $this->setNavigationOption(self::NAVIGATION_BULLETS_ENABLED, $value);
  }

  public function getBulletsEnabled() {
    return $this->getNavigationOption(self::NAVIGATION_BULLETS_ENABLED);
  }

  public function setArrowsEnabled($value) {
    $this->setNavigationOption(self::NAVIGATION_ARROWS_ENABLED, $value);
  }

  public function getArrowsEnabled() {
    return $this->getNavigationOption(self::NAVIGATION_ARROWS_ENABLED);
  }

  public function setArrowsHideAuto($value) {
    $this->setNavigationOption(self::NAVIGATION_ARROWS_HIDE_AUTO, $value);
  }

  public function getArrowsHideAuto() {
    return $this->getNavigationOption(self::NAVIGATION_ARROWS_HIDE_AUTO);
  }

  public function setArrowsRemoveOnTouch($value) {
    $this->setNavigationOption(self::NAVIGATION_ARROWS_REMOVE_ON_TOUCH, $value);
  }

  public function getArrowsRemoveOnTouch() {
    return $this->getNavigationOption(self::NAVIGATION_ARROWS_REMOVE_ON_TOUCH);
  }

  protected function setNavigationOption($option, $value) {
    if ($value) {
        $this->navigationOptions = $this->navigationOptions | $option;
    } else {
        $this->navigationOptions = $this->navigationOptions & ~$option;
    }
  }

  public function getNavigationOption($option) {
    return (($this->navigationOptions & $option) != 0);
  }

}


texts: Moved Magento to new server and Front end users can't login

texts:
I moved my Magento installation from a production server to my dev machine. I have the host mapped to dev.local/my site. Copied the DB as well and changed the URL references. I have done everything listed here =>https://magento.stackexchange.com/questions/22120/how-to-move-magento-shop-to-another-server#=

Everything appears to work and I can login to the admin side just fine but the weird part is I can't login to the store(frontend) using the test customer credentials I use in production. Resetting the password on the admin side for that user fixes the issue, but that's really not an option for me since I hope to do a migration to a different server.


texts: Magento 1 : Incorrect Search Title Showing

texts:
Making a website on Magento 1.9, I have created a title for the website to show on search engines. But on all ones am getting wrong title name. can anyone guide how to make correct the same?

as my title for the website is: Online Shopping Site in India for Women's Clothing, Cosmetics& More With Free Shipping

But on search engines, this is what shows

I doubt if I made a mistake. can anyone please guide in this regards?


texts: Magento 2.2 can't override default template

texts:
I am trying to override a default Magento html template, but no matter what I try, it won't work. Here are the two paths:

Default Magento path:

/project_folder/vendor/magento/module-ui/view/frontend/web/templates/form/element/helper/tooltip.html

Override Paths attemted:

/project_folder/app/design/frontend/Module/Component/Magento_Ui/view/frontend/web/templates/form/element/helper/tooltip.html

/project_folder/app/design/frontend/Module/Component/Magento_Ui/web/templates/form/element/helper/tooltip.html

/project_folder/app/design/frontend/Module/Component/Magento_Ui/templates/form/element/helper/tooltip.html

There are other files in the project that are overriding the default files in this same exact way and they all work. I've tried flushing the cache multiple times, deleting and deploying static content, running setup:upgrade, none of it works. Also, I know it's not redirecting because if I change anything in the default path, those changes show up.

Any help is appreciated.


texts:
does any body have idea that how to include masonry in magento 2?
as i added requirejs-config.js  them in masonry i used require on the top of the code then i added this code in bottom of list.phtml

<script type="text/javascript">
        requirejs( [ 'require', 'jquery', 'masonry' ],
            function( require, $, Masonry ) {
// require jquery-bridget, it's included in masonry.pkgd.js
                require( [ 'jquery-bridget/jquery-bridget' ],
                    function( jQueryBridget ) {
                        // make Masonry a jQuery plugin
                        jQueryBridget( 'masonry', Masonry, $ );
                        // now you can use $().masonry()
                        $('.grid').masonry({
                            // your settings
                        });
                    }
                );
            });
    </script>

but i am getting this error continuously.

https://imgur.com/a/Bvu6jTA


texts: I am trying to figure a way to hide show stock status/availability on product page unless it is out of stock. I have all the settings configured to where it displays stock status on front end as normal, however I don't want to show "In Stock" only if the item is out of stock then I want it to display Availability "Out of Stock" only. A lot of our items are ordered through other vendors and drop shipped to customer therefore I don't want to display stock status on those items. Only the items we exclusively ship from our location.


texts: How to connect multiwebsites to multi domain in godaddy hosting in magento2.2.4?

texts:
I have created multi website in admin panel and I tried to access this website from the browser.

I am getting 403 forbidden error.


texts: Magento 2: how to set grid getRowUrl via the uiComponent

texts:
In my current Magento 2 module developement, I currently have the following code in my Grid.php file:

public function getRowUrl($row)
{
    if ($id = $row->getMageProd()) {
        return $this->getUrl(
            'catalog/product/edit',
            ['id' => $id]
        );
    } else {
        return parent::getRowUrl($row);
    }
}

Is there any way I can implement such thing via my ui_component file ?


texts: How to download wishlist list item as a PDF in magento?

texts:
I would like to download wishlist items in PDF format.

there will be a button on wishlist item list page as "export as PDF" after clicking on this button i wants to download wishlist item list as a pdf format as it is.

app\design\frontend\rwd\default\template\wishlist\item\list.phtml

<?php
$columns = $this->getColumns();
$wishListTotal = 0;
?>

<?php
    /* @var $column  Mage_Wishlist_Block_Customer_Wishlist_Item_Column */
    foreach ($columns as $column):
        $_blockName = str_replace('.','-',strtolower($column->getNameInLayout()));
?>
    <th class="<?php echo $_blockName; ?>"><?php echo $column->getTitle();?>
<?php endforeach; ?>

<?php if (count($this->getItems())): ?>
<?php foreach ($this->getItems() as $item):
            $_product = $item->getProduct();
            $_priceIncludingTax = Mage::helper('tax')->getPrice($_product, $_product->getFinalPrice());
            $wishListTotal += $item->getQty() * $_priceIncludingTax;?>
    <tr id="item_<?php echo $item->getId();?>">
        <?php
            foreach ($columns as $key => $column):
                $_blockName = str_replace('.','-',strtolower($column->getNameInLayout()));

                /* Override default column title in layout, useful for certain cases like select all box */
                if ($column->getRwdTitle()) {
                    $_rwdLabel = $column->getRwdTitle();
                } else {
                    $_rwdLabel = ($column->getTitle()) ? $column->getTitle() : false;
                }
         ?>
            <td class="<?php echo 'wishlist-cell'.$key; ?> <?php echo $_blockName; ?>"<?php if($_rwdLabel): ?> data-rwd-label="<?php echo $_rwdLabel; ?>"<?php endif; ?>><?php $column->setItem($item); echo $column->toHtml($item);?>
        <?php endforeach; ?>

    <?php endforeach ?>
    <?php else: ?>
    <td colspan="<?php echo count($columns);?>" class="wishlist-empty"><?php echo $this->__('This quote has no Items');?>
  <?php endif; ?>

<?php echo $this->__("Grand Total");?>
<?php echo Mage::helper('core')->currency($wishListTotal, true, false); ?>
&nbsp;

  <?php foreach ($columns as $column): ?>
  <?php echo $column->getAdditionalHtml();?>
  <?php endforeach; ?>

anybody knows solution Please help....


texts: URL key not generating during product import

texts:
I am importing products through a CSV file from admin.
I have checked the CSV file, it contains _product_websites column with value "base".

But still URL keys are not generating after import.
Please help.


texts: add values for custom attributes programtically

texts:
We are creating product programtically & inserting values for default attributes with help of below code.

how i can add values for custom attributes .

attribute code : delivery_info , attribute label : Delivery & Return Info

protected function _createProduct($type, $doSave=true, $originalProduct)
    {

        Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

        $product = Mage::getModel('catalog/product');
        $product->setName($originalProduct->getName());
        $product->setDescription('what ever you need here')
                ->setPrice(599)
                ->setTaxClassId(0)    // Taxable Goods by default
                ->setWeight(1)
        ;

        if ($doSave)
            $product->save();

        return $product;
    }


texts: Setting Cron Job For every five minutes to clean up log tables will slow down the site?

texts:
I Have setup cron on my sites and it seems it was working fine I have scheduled them to clear the log tables for every 5 minutes. do this will down the performance of the site anymore? If so Do I need to extend the time of cron or any other things I have to follow ?

From OP comment: "My sort of problem is Log table dramatically increased so that I have setup the cron to clear it out, and Now Hosting have reported that sites performance frequently slows down with hits"


texts: 'Ships today if ordered now' message on product page

texts:
I want to display text between the product price and the availability.

When a product is in stock i want it to display: "Ships today is ordered before 17:00".

EDIT:
I created the attribute 'ships_today' and i have asigned it but it wont show on the product page. This is my code of view.phtml:

<?php if ($_product->isAvailable()): ?>

(<?php echo $this->__('In stock') ?>)

                    <?php echo $_product->getShipsToday(); ?>
                    <?php else: ?>

(<?php echo $this->__('Out of stock') ?>)

                    <?php endif; ?>


texts: solr 4.4 integration with magento - plausible?

texts:
Sorry to bring up a question that has already been answered on these forums. I have noticed there is a post on these forums clearly stating that magento 1.13 only supports solr 3.6.

I've informed my architect on this and even though the official line is clear he still wants me to investigate whether or not it is feasible to hack the solr config files to get 4.4 working with magento 1.13.

I understand where he is coming from as he is concerned about supportability of an old version of solr.

In people's opinions is hacking the solr config files to try and get 4.4 working with magento 1.13 a plausible theory? Or are there other factors at play that make this not possible at all?

thanks


texts: Front End and Backend Login Doesnt work Magento 1.9.3

texts:
My magento site is at this link:
http://frisbeemarketing.com/mom2b/customer/account/login/
the login page does not work and it does not send an error it just reloads

It seems like a problem with the REST API since that link is not found:
https://frisbeemarketing.com/mom2b/api/rest/products

i don't know what to do next with his info
i am a bit of a beginner and would need a step by step answer


texts: Magento Product Page showing error page frontend and backend

texts:
I was preparing to launch my site following this checklist

when I noticed that the product pages no longer loaded, showing the magento error page.

http://52.16.236.82/drilling/carbide-drills/general-machining.html

I have cleared the cache and reindexed but still the product pages wont load. The wierd thing is that the product details page wont load in the frontend or the backend.

All suggestions would help. Thanks in advance


texts: How to Update price automatically in Product page when qty or custom options changed?

texts: I want to update the price automatically without refreshing the page once the Qty has been changed. How to do this?


texts: Magento 2 Checkout How to identify that customer add new shipping address on checkout?

texts:
How to identify that customers add a new shipping address on checkout(if customers do not want that shipping address which showing on checkout page)?
After identifying the new address we need to update the customer address from the plugin.
We are using Plugin -
di.xml
 <type name="Magento\Sales\Api\OrderManagementInterface">
        <plugin name="send_new_address_to_thirdparty" type="Companyname\Namespace\Plugin\OrderManagement"/>
    </type>

OrderManagement.php
public function beforePlace(
        OrderManagementInterface $subject,
        OrderInterface $order
    ): array {
        $quoteId = $order->getQuoteId();
        if ($quoteId) {

           json_encode($order->getShippingAddress()->getData()));

           json_encode($order->getBillingAddress()->getData()));

            die;
        }
        return $order;
    }

We are successfully getting data in our custom log but unable to identify is customer add new shipping address
Does anyone know how to identify if customers add a new shipping address?


texts: Event sales_order_save_commit_after doesn't get triggered when I create shipment for specific order progrmatically

texts:
I have created a custom extension which contains event sales_order_shipment_save_after. It's get triggered when I create shipment for order from admin panel of Magento. But it's not get triggered when I create shipment for order programatically.

config.xml of custom extension

<sales_order_shipment_save_after>
                <observers>
                    <gb_gbgp_CreateParcel>
                        <type>model</type>
                        <class>gb_gbgp/observer</class>
                        <method>generateParcel</method>
                    </gb_gbgp_CreateParcel>
                </observers>
            </sales_order_shipment_save_after>

programatically creating shipment as follows:
public function create(){

    $itemQtys = array();
    $orderID = 100000123;
    $order = Mage::getModel('sales/order')->loadByIncrementId($orderID);
    foreach ($order->getAllItems() as $orderItem) {
        if ($orderItem->getQtyToShip() && !$orderItem->getIsVirtual()) {
            $itemQtys[$orderItem->getId()] = $orderItem->getQtyToShip();
        }
    }
    $shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($itemQtys);
    $shipment->register();
    $order->setIsInProcess(true);
    Mage::getModel('core/resource_transaction')
             ->addObject($shipment)
             ->addObject($order)
             ->save();

}
The above function creates shipment for order but event doesn't trigger


texts: magento 2 unable to redirect to external url from observer

texts:
I made modules that work fine but unable to redirect to another url when event fired

what code does when adding to cart is pressed I want to redirect to other URL say google.com

my module works as a log file is generated.

I also get error when i inspected console:

  Fatal error:  Call to undefined method Devshree\Affliliate\Observer\GetQuote::_redirect() in /var/www/html/magento/app/code/Devshree/Affliliate/Observer/GetQuote.php on line 15

below is my code :

Devshree\Affliliate\etc\frontend\events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="checkout_cart_save_before">
        <observer name="devshree_affliliate_event_obs" instance="Devshree\Affliliate\Observer\GetQuote" />
    </event>
</config>

Devshree\Affliliate\Observer\GetQuote.php

namespace Devshree\Affliliate\Observer;

use \Magento\Framework\Event\Observer;
use \Magento\Framework\Event\ObserverInterface;

    class GetQuote implements ObserverInterface {
        public function execute(Observer $observer) {
            $myfile = fopen("/var/www/html/magento/var/logdebug.log", "a+") or die("Unable to open file!");
            $abc = "heello";
            fwrite($myfile, print_r($abc,true));
            fclose($myfile);
            return $this->_redirect('*/auth/login');
        }
    }


texts: Magento 2 : Category page not listing all the products

texts:
I am working on a Magento 2 store , which have more than 30000 products in it. And out of all categories , 1-2 categories have more than 12000 products.

But for the category which have more than 12000 products , on the front end I can see only 10000 products.

Can anyone please help , What should be the issue?


texts: How to cache a block in block_html cache type in Magento 2?

texts:
I have a block file that does heavy data processing due to which my product page PHP rendering time increases above 2 seconds. I have disabled page_cache in my Magento 2 system so i cannot use cacheable="true" in my layout file that loads this block file with it's template. I am looking for a solution where i can cache this file code into block_html cache type. Can anyone please tell me the solution on how i can implement this functionality.

My SampleClass is below which is extending core Magento 2's \Magento\Catalog\Block\Product\View class:

class SampleClass extends \Magento\Catalog\Block\Product\View
{
 //rest of my code like __construct and other custom methods.
}


texts:
I want to move my magento site from AWS to Google and I want to make sure Im doing it the right way as I am new with google cloud computing. These are the steps Im planning on doing:

create an instance and install redis and my magento store on it.
create sql for my DB
create a snapshop of this instance
create a template from this snapshot
create a group of instances with the template
create a load balancer and connect it with the instance group

is that the correct way to build a solid and fairly scalable magento site on Google cloud?

are there any other services I can use to make my store even more fast and scalable?

Any suggestions would be welcome (:

Thanks


texts: How to programmatically add discount to order total on magento 2

texts: I need to programmatically add custom discount to order total on magento 2. This will work in such a way that when the customer inputs a code in the checkout page, a certain amount will be discounted from the order total


texts: Magento how to create partial invoice programmatically

texts:
With the ref https://stackoverflow.com/questions/20799498/magento-create-partial-invoice-programmatically
I have tried but it's occurred only for shipping cost or single sku of multiple sku. I want to create $100 invoice out of $500 subtotal of order. I mean if subtotal is $500 I want to create two separate invoice. one is $100 & another is $400 .
Need a help, Thanks in advanced.


texts:
I have installed an extension that allows me to prevent certain customer groups from accessing certain products/categories.

E.x. Only my retailer customers have access to product displays etc.

When a retail user logs in and clicks the category link for those products, they are sent to that page. Any customer not logged in or not belonging to that group is redirected to the "404 Page Not Found" page.

My question is where can I change this action to redirect to a page of my choosing?

Currently on version 1.7


texts: What is the cleanest way to enforce length limitations on customer's address in admin panel?

texts:
For a client we're exporting all the address information that goes into Magento into a third party processing system.  The details about this is unimportant - but what is important is that things go terribly wrong if fields are longer than an expected amount of characters.

For this reason, we're using the API with substr in order to truncate the data down to the expected size - but this isn't really good enough.  The staff using the admin panel is apparently of a decent size and can't be trained to use it correctly, so we also need to apply this limitations to the admin panel itself.

As we don't really care about them using technical know-how to get past these limitations, all we really need is a maxlength="x" on the form elements.  It is a requirement that different form elements may have different maxlengths.

What is the cleanest, most upgrade-proof way to enforce a maximum length on the customer address fields in the admin panel?

My first thought was using JavaScript - but the fields don't have really predictable identifiers, so I'm not sure I can easily.  Because they all use the form rendering stuff, I also can't just edit a template file by creating a custom admin theme.

Phrased another way:  What's the easiest and cleanest way to add a maxlength attribute to these fields?


texts:
OK I really dont get this, I am trying to add a product to the cart and save the quote, this is working great for simple products but I can not get the bundle products to work here is my code

        $params = array(
            'product' => $addId, // the bundle product id
            'qty'     => $addQty, // the qty of the bundle product
            'options' => $optsArray,  .. used for simple products with options

            'bundle_option' => array(
                251 => 1, // add 1 X product 251
                250 => 1, // add 1 X product 250
                249 => 2 // add 2 X product 249
            )

        );

        $quote->addProduct($addProduct, new Varien_Object($params));
        $quote->save();

I dont understand what I am doing wrong any help would be greatly appreciated, I cant seem to find what variable sthe bundle_options array expects


texts: Check products attibute after place order

texts:
I'm making an observer to check after a order is made, if there is any product inside that order that has the sync attribute marked as "Yes".

I'm confused about the models and methods I'd use to make it.

Is this the best way to do it? Can someone give me an example of the methods I would need?


texts: how to display image in dropdown menu in magento without using any plugins

texts:
In Magento i have added categories and subcategories,these will be displayed in home page of my website.

Now, I want to display subcategories along with respective image. But I do not want to use any extensions provided by Magento.

Below snapshot shows how my dropdown menu looks, but i want to add image to respective category.

This is the code which i have added in renderer.phtml
app/design/frontend/rwd/default/template/page/html/topmenu

<?php

$html = '';

$children = $menuTree->getChildren();
$parentLevel = $menuTree->getLevel();
$childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;

$counter = 1;
$childrenCount = $children->count();

$parentPositionClass = $menuTree->getPositionClass();
$itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';

foreach ($children as $child) {
    $child->setLevel($childLevel);
    $child->setIsFirst($counter == 1);
    $child->setIsLast($counter == $childrenCount);
    $child->setPositionClass($itemPositionClassPrefix . $counter);

    $outermostClassCode = 'level'. $childLevel;
    $_hasChildren = ($child->hasChildren()) ? 'has-children' : '';

    $html .= '
_getRenderedMenuItemAttributes($child) .'>';

    $html .= 'getUrl() .'" class="'. $outermostClassCode .' '. $_hasChildren .'">'. $this->escapeHtml($this->__($child->getName())) .'';

    if (!empty($childrenWrapClass)) {
        $html .= '
';
    }

    $nextChildLevel = $childLevel + 1;

    if (!empty($_hasChildren)) {
        $html .= '
';
        $html .=     '
';
        $html .=         'getUrl() .'">';
        $html .=             $this->__('View All') . ' ' . $this->escapeHtml($this->__($child->getName()));
        $html .=         '';
        $html .=     '
';
        $html .=     $this->render($child, $childrenWrapClass);
        $html .= '
';
    }

    if (!empty($childrenWrapClass)) {
        $html .= '
';
    }

    $html .= '
';

    $counter++;
}

return $html;

and following code i have added in app/design/frontend/rwd/default/template/page/html/topmenu.phtml

<?php $_menu = $this->getHtml('level-top') ?>
<?php if($_menu): ?>

        <?php echo $_menu ?>

<?php endif ?>

and also i have added following code in app/etc/modules/WP_customMenu.xml
to display the category list in customized form

<?xml version="1.0"?>
<config>
    <modules>
        <WP_CustomMenu>
            <active>true</active>
            <codePool>community</codePool>
        </WP_CustomMenu>
    </modules>
</config>


texts: in Magento 2,How can I implement star rating in my custom module

texts: I am Unable to move ahead in implementing the star rating in magento 2,because i was clue less,Please can anyone give me possible solutions,so that i can complete my star rating.


texts: Get Attribute Option Position from Option value

texts:
I have a dropdown attribute with many options.

In cart.phtml I already get the attribute value for each item

Mage::getModel('catalog/product')->load($_item->getProduct()->getId())->getMyAttribute();

In addition to that I want to get the option position.

How can I do that without loading all Attribute options.


texts: Magento 2: How to create a custom api and get post json?

texts:
I found many tutorial in the INTERNET but they always use GET method to be a example.

So, my question is how to let API receive post data if the data is JSON format ?


texts:
I'm a bit lost. I have a component that sits in the minicart that should update when the cart changes (so when subtotal changes). Now I know you have events but I need to fire a JavaScript function when the subtotal changes. I tried looking into Magento 2 imports and exports but I'm stuck and I'm not sure if this is the right way to approach this.

What I'm currently trying is to share the subtotal observable from module-tax with my component.

  module-tax/web/js/view/checkout/minicart/subtotal/totals.js

/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
define([
    'ko',
    'uiComponent',
    'Magento_Customer/js/customer-data'
], function (ko, Component, customerData) {
    'use strict';

    return Component.extend({
        displaySubtotal: ko.observable(true),
        self: this,

        defaults: {
            exportTarget: "minicart_content.subtotal.container.subtotal.subtotal",
            exportTargetProperty: "totals",

            tracks: {
                shouldShowMessage: true
            },

            'exports': {
                'shouldShowMessage': '${$.exportTarget}:${$.exportTargetProperty}'
            }
        },

        /**
         * @override
         */
        initialize: function () {
            this._super();
            this.cart = customerData.get('cart');
        }
    });
});

Vendor/Module/view/frontend/web/js/view/minicart.js

define([
    'ko',
    'uiComponent',
    'jquery',
    'mage/url'
], function (ko, Component, $, url) {
    'use strict';

    return Component.extend({
        html: '',

        defaults: {
            exportTarget: "minicart_content.subtotal.container.subtotal.subtotal",
            exportTargetProperty: "totals",

            'imports': {
                'subtotal': '${$.exportTarget}:${$.exportTargetProperty}'
            }
        },

        initialize: function () {
            this._super();
            this.getData();

            console.log(subtotal);
        },

        getData: function(){
            var thisComponent = this;

            $.ajax({
                url : url.build('/freeshippingbar/index/index'),
                type : 'post',
                dataType : 'json',
                success : function (result) {
                    var mess=$.parseHTML(result);

                    thisComponent.html = '';

                    for(var i = 0; i < mess.length; i++){
                        thisComponent.html+= mess[i].textContent;
                    }
                },
                error: function(error) {
                    console.log('Error: ', error);
                }
            });
        }
    });
});

There might be a better way to achieve what i'm looking to do, if you know anything please tell me.

// UPDATE

I decided to give up on import export and get the cart subtotal trough 'Magento_Customer/js/customer-data', but i'm still stuck on watching/subscribing if that changes. Any idea?


texts:
Please, how can i resolve this problem? my setup script doesn't work when i enable my module using this command:

  php bin/magento module:enable Demo_Demo

<?php

namespace Demo\Demo\Setup;

use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\Setup\ModuleContextInterface;

class InstallSchema implements InstallSchemaInterface
{
    public function install(SchemaSetupInterface $setup)
    {
        $setup->startSetup();

        $data = [];
        $statuses = [
            'demo_payed' => __('payed'),
            'demo_error' => __('error'),
            'demo_processing'  => __('processing'),
        ];
        foreach ($statuses as $code => $info) {
            $data[] = ['status' => $code, 'label' => $info];
        }

        $setup->getConnection()
            ->insertArray($setup->getTable('sales_order_status'), ['status', 'label'], $data);

        $setup->endSetup();
    }

}


texts:
I want to retrieve store-email in phtml file so far i've fetched store data information like this but there's no info about e-mail address:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeInformation = $objectManager->create('Magento\Store\Model\Information');
$store = $objectManager->create('Magento\Store\Model\Store');
$storeInfo = $storeInformation->getStoreInformationObject($store);
$storeData = $storeInfo->getData();


texts: Catalog Price Rule not applied / working in Magento 2 EE (v2.1.2)

texts:
After applying Catalog Price Rule, price did not change even though the schedule changes already started. But I can see the price change in preview mode only. checked in Magento 2.1.4 too
Why ?