texts: Loosing category link when saving product (at store level)

texts:
So, I'm getting a product collection for a store, affecting a data change and saving the product:

Mage::app('english', 'store');
$products = Mage::getModel('catalog/product')->getCollection()
    ->setStore('english'); // clarity, you cannot actually influence it
foreach($products AS $product)
{
    $product->setName($product->getName(). ' '); // add space to trigger hasDataChange
    $product->save();
}

After this loop, my entire catalog/product association is gone for all storeviews (indexes are on UPDATE, but even then - a reindex does not help).

What's the cause of this and how should I do it instead? It's imperative that I get the collection for a user-specified store, so I can't do Mage::app('admin') in my script.

Note: this is a 1.7.0.0 installation (due for upgrade).


texts: Add Custom Grid into a Custom Tab in Product Edit Page collection filter by current product id

texts:
As per my requirement, I need to add a custom grid into a custom tab in the product edit page.

for that, I got one of the good tutorials, but in that, I need to filter the collection by the current product id.

http://www.codextblog.com/magento-2/how-to-add-custom-grid-into-a-custom-tab-in-product-edit-page-in-magento-2-admin/

But right now the grid gets the full collection of the custom model.

In that how can I achieve the filter using the current product id?

Updated code in
custom_grid_listing.xml

<dataSource name="questionanswer_grid_listing_data_source" component="Magento_Ui/js/grid/provider">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
            <item name="filter_url_params" xsi:type="array">
                <item name="product_id" xsi:type="string">*</item>
            </item>
            <item name="update_url" xsi:type="url" path="mui/index/render"/>

            <item name="storageConfig" xsi:type="array">
                <item name="cacheRequests" xsi:type="boolean">false</item>
            </item>
        </item>
    </argument>
</dataSource>

CustomDataProvider.php

Then i am using below code go get the product_id from the URL, but in URL dont have any product realated infromation

$params =  $this->_request->getParams();
$urlInterface = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\UrlInterface');
echo $urlInterface->getCurrentUrl();
echo "<pre>"; print_r($params);

Kindly check the details and share your knowledge.

Thanks in advance for your help and support.


texts: Magento 2, How to delete unused images using php script

texts:
I have more than 50,000 images in pub/media of products.

But there are so many unused images so I want to remove all images which are not associated with any product.

For magento 1.9.x this can be a Reference link
but i want the same php script for magento 2.1.


texts: Front-End stopped working after magento upgrade

texts: Front-end stopped working after a 2.2.6 upgrade. As you can see on screenshots, there is something wrong with the styles-m.css file.


texts:
Basically I want to show static content using a block on my category menu in Magento 2.3.5. I have created a category and set Display Mode as Static Block only, Anchor set to No and Added a block from Add CMS Block dropdown, but the issue is when I try to browse this category it shows
We can't find products matching the selection.
How to hide this message.


texts: Magento 2 How to add custom sort by option

texts:
I need to add an additional filter based on created_at attribute for sorting product list by latest product. I tried to figure it using below file

app/design/frontend/Vendor/ThemeName/Magento_Catalog/templates/product/list/toolbar/sorter.phtml

but how can add our entity id to getAvailableOrders() ?


texts:
<?php
$needle= $_GET["singleid"];

$collection = Mage::getModel('catalog/product')->getCollection()->load();

$_productCollection = $collection->addAttributeToFilter('name', array(
    array('like' => '% '.$needle.' %'), //spaces on each side
    array('like' => '% '.$needle), //space before and ends with $needle
    array('like' => $needle.' %') // starts with needle and space after
));
foreach ($_productCollection as $_product){
   echo $_product->getId().'
';
   echo $_product->getName().'
';
   **echo $_product->getProductUrl().'
';**//getting this only
   echo $_product->getPrice().'
';
}

?>

i am trying to get product collection based on product name but i get only product URL.i am trying get other attributes like name.my purpose is to create a search page


texts:
I would like to send different transactional email based on ordered product category.
What is the best solution to achieve this?

The goal is to send emails:
 - based on category if ordered products are from single category
 - send default one for products from multiple categories

Since content will be very similar, maybe its better to add layout handle?


texts: Magento 2: PWA : FetchError: request to https://local.magento.com/graphql failed, reason: connect ECONNREFUSED 127.0.0.1:443

texts: Please help me? I got an error when yarn run build


texts: Product catalog images in product page goes missing as soon as Flush Catalog Image Cache

texts:
On certain images my end user complained that the images in product detail page are missing for certain products. So, I tried to reproduce the issue. I deleted all the images from one of the product that was having problem. Added images back from admin panel and saved the product.
refresh that product page in frontend and image came back. Now I clear cache on Flush Catalog Image Cache option from admin panel, check the page again and images were again missing.
Note: this is happening with certain products only.
To get all the product images generated again, I already did
php bin/magento catalog:image:resize

But as soon as I flush catalog images, the same problem comes back.
I further investigated the problem and tried below remedies too but none of them is working for me:
sudo chmod -R 777 var/cache
sudo chmod -R 777 pub/media

I checked .htaccess file inside media folder which is there.
I did a small comparison between the product that is showing images and one that is not showing. All I find is the missing images product was having just one copy of image. So I can understand catalog cache images for certain products are not getting generated.
I am using Magento ver. 2.3.5-p1 on Ubunto 18.04 on GCP
I hope the information is sufficient for you folks to understand the error and solve it.
Tried this Solution too:
select path, value from core_config_data where path like '%water%';

and get this result:
+-------------------------------------------+---------+
| path                                      | value   |
+-------------------------------------------+---------+
| design/watermark/image_size               | NULL    |
| design/watermark/image_imageOpacity       | NULL    |
| design/watermark/image_position           | stretch |
| design/watermark/small_image_size         | NULL    |
| design/watermark/small_image_imageOpacity | NULL    |
| design/watermark/small_image_position     | stretch |
| design/watermark/thumbnail_size           | NULL    |
| design/watermark/thumbnail_imageOpacity   | NULL    |
| design/watermark/thumbnail_position       | stretch |
| design/watermark/image_imageOpacity       | 40      |
| design/watermark/image_position           | center  |
+-------------------------------------------+---------+

And I really don't know what to do with this if watermark is not there.


texts: How to dynamically fill dropdown attribute

texts:
I need an attribute that is used in the Layered Navigation. The values for the dropdown attribute should be dynamically filled. An API service between Magento and an external ERP system provides product sync during the night. Values for the dropdown attribute could be added and should be somehow added to the available dropdown values.

It there anyway to make this possible?


texts: Magento 2 get Block Toolbar custom module gives Error

texts:
In catalog_category_view.xml

    <referenceContainer name="content">
        <block class="Magento\Catalog\Block\Product\ProductList\Toolbar" name="my-block-name" template="Vendor_Module::contents.phtml"/>
    </referenceContainer>

In content.phtml

/**
 * Product list toolbar
 *
 * @var $toolBarBlock \Magento\Catalog\Block\Product\ProductList\Toolbar
 */
print_r(toolBarBlock->getTotalNum());

I get error:

"PHP message: PHP Fatal error:  Uncaught Error: Call to a member
 function getSize() on null in
 .../htdocs/vendor/magento/module-catalog/Block/Product/ProductList/Toolbar.php:609

Line 609:

/**
     * @return int
     */
    public function getTotalNum()
    {
        return $this->getCollection()->getSize();
    }

Not sure what I am missing anyone any idea?


texts: Want to call magento2 rest api from react js

texts:
I am creating 1 application in react and have a requirement to call magento api from react js

My magento application is hosted on http://localserver.com and react is with http://localhost:3000/

Below is my code in react

import React, { Component } from 'react';
class App extends Component{

  constructor(props) {
    super(props);
    this.state = {
      error: null,
      isLoaded: false,
      items: []
    };
  }

  componentDidMount() {
    fetch("http://localffc.com/rest/V1/directory/areas/AE")
    .then(res => res.json())
    .then(
      (result) => {
        this.setState({
          isLoaded: true,
          items: result
        });
      },
      // Note: it's important to handle errors here
      // instead of a catch() block so that we don't swallow
      // exceptions from actual bugs in components.
      (error) => {
        this.setState({
          isLoaded: true,
          error
        });
      }
    )
  }

  render() {
    const { error, isLoaded, items } = this.state;
    if (error) {
      return
Error: {error.message}
;
    } else if (!isLoaded) {
      return
Loading...
;
    } else {
      return (

          {items.map(item => (

          ))}

      );
    }
  }
}

export default App;

But I am getting below error

Access to fetch at 'http://localserver.com/rest/V1/directory/areas/AE' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Please help me how i can fix it.


texts: Find distance between two customers using address

texts:
I have to find the distance between two customers using their address. I tried getting latitude and longitude of the customers using google map geocode API. But I encounter this error "You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable".
Is there any way I can get latitude longitude without having to create a billing account.


texts: Magento 2 : Are there any APIs to import massive external data (products) from a third-party application into Magento2 database programmatically?

texts: Are there Magento2 API to import massive external data (products) from a third-party application into Magento2 database programmatically using API?


texts:
I have question, for example, we have some redirect:
class toto extends \Magento\Framework\App\Action\Action
{
    protected $_resultPageFactory;
    protected $_resulFactory;

    public function __construct(
            \Magento\Framework\App\Action\Context $context,
            \Magento\Framework\View\Result\PageFactory $resultPageFactory,
            \Magento\Framework\Controller\ResultFactory $resulFactory,
            )
    {
        parent::__construct($context);
        $this->_resultPageFactory = $resultPageFactory;
        $this->_resultFactory = $resulFactory;
    }

    public function execute()
    {
    $resultRedirect = $this->_resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT);
    $resultRedirect->setPath('homepage.html');
    return $resultRedirect;
    }

And question is:"how in this controller i can get this redirect url.
For example i want add new checking, if redirect url page equal 'homepage':
public function execute()
{
    $resultRedirect = $this->_resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT);
    $resultRedirect->setPath('homepage.html');

    if('get redirect url' == 'homepage')
    {
        //some code
        $resultRedirect->setPath('bar.html');
    }
    return $resultRedirect;
}

So how can i get url after setPath method?


texts: How to Load disabled products last in a product collection?

texts: I would like to load Disabled products last or bottom in a product collection in a category listing. I want some thing like enabled products followed by disabled products in a product collection. is this possible in magento?


texts: Get product ID in Bundle selection dropdown

texts:
I'm using bundle products, and want to get the ID of simple products.

I was trying to get the ID from the product selection, but I think it's impossible.

My code:

<?php foreach ($_options as $_option): ?>
<?php
$_selections = $_option->getSelections();
foreach ($_selections as $_selection) {
    $id = $_selection->getProductId();
    $product = Mage::getModel('catalog/product')->load($id);

    $descripcion = $product->getDescription();
    $descriptions[ $id ] = $descripcion;
}
?>

But the $_selection->getProductId() its the product ID SELECTION, not the product ID from catalog.

Any idea?


texts: How to get product image & remove background color on PDF invoice Magento 2.x?

texts:
I need help to customize the Magento 2.x PDF invoice for Print.

I want to remove the Black color from the invoice. Please check on Attached image below.
I want to add product image on PDF invoice.

Could you please help me how can I make this and I am using Third party theme.

Please check Attached image below.


texts: Add custom options programmatically not working on product page

texts:
When i execute follow code

    $options = [
    [
        'title' => 'drop_down option',
        'type' => 'drop_down',
        'is_require' => true,
        'sort_order' => 4,
        'values' => [
            [
                'title' => 'drop_down option 1',
                'price' => 10,
                'price_type' => 'fixed',
                'sku' => 'drop_down option 1 sku',
                'sort_order' => 1,
            ],
            [
                'title' => 'drop_down option 2',
                'price' => 20,
                'price_type' => 'fixed',
                'sku' => 'drop_down option 2 sku',
                'sort_order' => 2,
            ],
        ],
    ]
];

foreach ($options as $arrayOption) {
    $option = $this->objectManager->create(\Magento\Catalog\Model\Product\Option::class)
        ->setProductId($_product->getId())
        ->setStoreId($_product->getStoreId())
        ->addData($arrayOption);
    $option->save();
    $_product->addOption($option);
    $_product->save();
}

Custom Option not appear on product frontend page.
When goto to product page from admin page and click save without any
changing.
Then goto frontend product page custom show up.

I want create option programmatically and should shown on front page without saving product from admin panel.


texts: Add to cart button freezes and nothing is put in basket

texts:
We currently run a Magento 2 Store with the Porto theme from Smartwave.

We use the TIG PostNL extension for shipping.
After the latest update of this extension the add to cart button doesn't work anymore.
The nice people at TIG checked it and said nothing is disturbing the process.

In the log files I found:

  [06-Jul-2018 05:30:15 UTC] PHP Fatal error:  Uncaught Error: Call to a
  member function getParentItem() on null in
  /home/fotoloom/public_html/app/code/Smartwave/Dailydeals/Observer/DealProductDiscountPrice.php:27
  Stack trace: 0
  /home/fotoloom/public_html/vendor/magento/framework/Event/Invoker/InvokerDefault.php(72):
  Smartwave\Dailydeals\Observer\DealProductDiscountPrice->execute(Object(Magento\Framework\Event\Observer))
  1
  /home/fotoloom/public_html/vendor/magento/framework/Event/Invoker/InvokerDefault.php(60):
  Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Smartwave\Dailydeals\Observer\DealProductDiscountPrice),
  Object(Magento\Framework\Event\Observer)) 2
  /home/fotoloom/public_html/vendor/magento/framework/Event/Manager.php(66):
  Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array,
  Object(Magento\Framework\Event\Observer)) 3
  /home/fotoloom/public_html/generated/code/Magento/Framework/Event/Manager/Proxy.php(95):
  Magento\Framework\Event\Manager->dispatch('checkout_cart_p...', Array)
  4 /home/fotoloom/public_html/v in
  /home/fotoloom/public_html/app/code/Smartwave/Dailydeals/Observer/DealProductDiscountPrice.php
  on line 27**

It appears to me this could cause the error. However Smartwave says it also happens if the template is disabled.

I am looking for a solution and can't find it.

Could you tell me where to look to solve this issue? Clients are walking away and already a weak trying to find a solution. Even the hoster says nothing on their side and Redis is configurated well.

I am desperate right now.


texts: Magento 2.2.6 How to Prevent Spam Account Registration

texts:
I tried to use the solution 6 from here, but not exactly sure how to do it.

  Prevent Spam Account Registration
  Solution 6: Update fields limitation rules from database : directly in
  the customer_eav_attribute table, update rows with attribute_id=5
  [firstname] and attribute_id=7 [lastname] and replace 255 by 25 :

In my magento 2.2.6 version, the attribute_id=5 and 7 has

  validate_rules="{"max_text_length":225,"min_text_length":1}"

and also

  input_filter="trim"

I tried to change them to

  validate_rules ="{"max_text_length":25,"min_text_length":1}"

and

  input_filter =""

but i'm still getting a lot of Russian spam account registration.


texts: Enhanced Ecommere GTM - GA in Magento 1.9.x

texts:
Could you recommend me how to develop an enhanced e-commerce for Magento 1.9.x?

I think having an enhanced e-commerce with Google analytics is very good.


texts: How to format the navigation menu in Magento?

texts:
I have made my own theme from the RWD theme. Now, as seen in the first pic below, my sub-menus overlap. I do not want this. I want it to be like the second pic so the sub-menu nicely aligns to the right with the parent element.

What I am after:


texts: Pinterest Buyable Pins Magento Integration

texts:
just fascinated by the new pinterest concept of buyable pins . Where customer can buy products (marked by 'buy it'  blue button) from pinterest itself without redirecting to our magento store . Although for processing the product i.e at checkout process , magento's payment system is used .

Now as i assume it's done by magento's SOAP API triggered at pinterest for starting two-way communication b/w magento store and pinterest . I have good idea about magento system but not for pinterest .

Although there's an extension worth 499 dollars but i am trying to build buyable pins for our magento store's product myself . After searching a lot can't find any good developer resource for creating buyable pins .

So if anybody can provide me hints on how to create it or any helpful links . Thanks .


texts: Magento - Call to a member function addAttributeToSelect() on a non-object

texts:
I'm getting this error when trying to filter products by a custom attribute.

In magento i have setup my custom attribute as 'featured' with 'yes/no' choice. This attribute has then been assigned to all attribute sets and various products then set to yes on the featured value.

On my homepage (cms page) i am then loading my template as a block

{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" category_id="45" column_count="4" template="catalog/product/homelist.phtml"}}

And my template code (homelist.phtml) consists of the following

<?php
    $_productCollection=$this->getLoadedProductCollection();
    $_helper = $this->helper('catalog/output');
?>
<?php if(!$_productCollection->count()): ?>

<?php echo $this->__('There are no products matching the selection.') ?>

<?php else: ?>

<?php // Grid Mode ?>

    <?php $_iterator = 0; ?>

<?php
    $_items = $_productCollection->getItems();
        $_items->addAttributeToSelect('featured');
        $_items->addFieldToFilter(array(
            array('attribute' => 'featured', 'eq' => true),
        ));
?>
<?php $_collectionSize = 5 ?>

    <?php $_columnCount = 5; ?>
    <?php $i=0; foreach ($_items as $_product): ?>
    <?php if ($i++%$_columnCount==0): ?>

    <?php endif ?>
            <li class="item<?php if(($i-1)%$_columnCount==0): ?> first alpha<?php elseif($i%$_columnCount==0): ?> last omega<?php endif; ?> col span_1_of_5">
                <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>

 <?php // echo $this->stripTags($this->helper('core/string')->truncate($_product->getDescription(),65,'...', $_remainder, false)) ?>

 <?php echo $this->stripTags($this->helper('core/string')->truncate($_product->gets_desc(),200,'...', $_remainder, false)) ?>

                <?php echo $this->getPriceHtml($_product, true) ?>

                    <?php if($_product->isSaleable()): ?>
                        <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><?php echo $this->__('Add to Cart') ?></button>
                    <?php else: ?>

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

                    <?php endif; ?>

    <?php if ($i%$_columnCount==0 && $i!=$_collectionSize): ?>

    <?php endif ?>

    <?php if($i==5): ?>
        <?php break; ?>
    <?php endif; ?>
    <?php endforeach ?>

    <?php if ($i%$_columnCount==0): ?>

    <?php endif ?>

<?php endif; ?>


texts: Multiple Magento 2 Sites Varnish Configuration

texts:
I have a dedicated server centos 6 Apache I have different Magento 2 sites on the server with there own ip and domain. I have installed and configured Varnish for one site / ip running Magento 2 site and used the Varnish configuration file generated in the admin and uploaded to [Home]/etc/varnish and renamed the file as default.vcl below is the settings section.
My problem is if I try to add any more sites/ip the varnish will not restart shows failed. please can someone tell me exactly how to add more sites to the configuration file and I can fill in my ip accordingly.
Secondly I want to ask when I have different Magento 2 sites and 1 varnish when I clear cache in any site will it also clear / purge for all sites - or will they work independently
backend default {
    .host = "88.151.196.121";
    .port = "8080";
    .first_byte_timeout = 600s;
    .probe = {
        .url = "/pub/health_check.php";
        .timeout = 2s;
        .interval = 5s;
        .window = 10;
        .threshold = 5;
   }
}

acl purge {
    "localhost";
}

sub vcl_recv {
    if (req.method == "PURGE") {
        if (client.ip !~ purge) {
            return (synth(405, "Method not allowed"));
        }


texts:
In my /app/design/frontend/<vendor>/<theme>/Magento_Theme/layout/default.xml file I am trying to reference our CDN for things like our author link.  This is what I have now.

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <link rel="shortcut icon" src="https://repo.wsu.edu/spine/1/favicon.ico" />
        <link type="text/plain" rel="author" src="https://repo.wsu.edu/spine/1/authors.txt" />
        <link type="text/html" rel="help" src="https://brand.wsu.edu" />

    </head>
    <body>
        <move element="catalog.topnav" destination="spine.spine.glue" before="-"/>
    </body>
</page>

what I get out is this

<link  rel="shortcut icon" href="http://mage2.wsu.dev/static/frontend/wsu/wsu_base/en_US/https://repo.wsu.edu/spine/1/favicon.ico" />
<link  rel="icon" type="image/x-icon" href="http://mage2.wsu.dev/static/frontend/wsu/wsu_base/en_US/Magento_Theme/favicon.ico" />
<link  rel="shortcut icon" type="image/x-icon" href="http://mage2.wsu.dev/static/frontend/wsu/wsu_base/en_US/Magento_Theme/favicon.ico" />
<link  type="text/plain" rel="author" href="http://mage2.wsu.dev/static/frontend/wsu/wsu_base/en_US/https://repo.wsu.edu/spine/1/authors.txt" />
<link  type="text/html" rel="help" href="http://mage2.wsu.dev/static/frontend/wsu/wsu_base/en_US/https://brand.wsu.edu" />

The issues are first, the icon didn't get replaced, would have expected it to for items that only really work with one of them declared like the shortcut icon.  This is a short fall in my eyes but I get that I more then likely will need to do some remove/delete/unset type of node in the xml to rid the layout of the system driven link that needs to come from our CDN.

What I am not finding any information on in the documentation is why we are getting

http://mage2.wsu.dev/static/frontend/wsu/wsu_base/en_US/https://repo.wsu.edu/spine/1/authors.txt

when we expected

https://repo.wsu.edu/spine/1/authors.txt

from the node

<link type="text/plain" rel="author" src="https://repo.wsu.edu/spine/1/authors.txt" />.

Is there a way to use the external url with out an override of the core?  If not, any ideas on the best point to inject the change?


texts: Extending Product Select Options block is not applying

texts:
I have app\code\local\Etre\Categories\Block\Rewrite\Catalog\Product\View\Options\Type\Select.php extending Mage_Catalog_Block_Product_View_Options_Type_Select like this:

<?php
class Etre_Categories_Block_Rewrite_Catalog_Product_View_Options_Type_Select
    extends Mage_Catalog_Block_Product_View_Options_Type_Select{
    /**
     * Return html for control element
     *
     * @return string
     */
    public function getValuesHtml()
    {
        die('Now we can continue.');
    }
}

In app\code\local\Etre\Categories\etc\config.xml I have:

<?xml version="1.0"?>
<config>
    <modules>
        <Etre_Categories>
            <version>0.1.0</version>
        </Etre_Categories>
    </modules>
    <global>
        <blocks>
            <etre_categories>
                <class>Etre_Categories_Block</class>
            </etre_categories>
            <catalog>
                <rewrite>
                    <product_view_options_type_select>Etre_Categories_Block_Rewrite_Catalog_Product_View_Options_Type_Select</product_view_options_type_select>
                </rewrite>
            </catalog>
        </blocks>

The best that I know how to I have checked for conflicts but have not found any.


texts:
What are hosting requirements for magento 1.9 ? My website have 1000 visits per day and have narrow my choice to 2 providers:

1.https://www.tmdhosting.com/magento-hosting.html

2.https://www.nexcess.net/magento/hosting


texts:
I am trying to create an observer on a specific event to save on session the url referrer.

I created this structure:
http://screencast.com/t/TG7brmUi

The module seems OK, I can see on magento config.
http://screencast.com/t/5d4FXIJwrGk

the code is as follows:

Luisvalencia_Affiliate.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Luisvalencia_Affiliate>
            <active>true</active>
            <codePool>community</codePool>
        </Luisvalencia_Affiliate>
    </modules>
</config>

config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Luisvalencia_Affiliate>
            <version>0.0.1</version>
        </Luisvalencia_Affiliate>
    </modules>
    <frontend>
        <events>
            <controller_action_predispatch>
                <observers>
                    <luisvalencia_affiliate>
                        <class>luisvalencia_affiliate/observer</class>
                        <method>captureReferral</method>
                        <type>singleton</type>
                    </luisvalencia_affiliate>
                </observers>
            </controller_action_predispatch>
        </events>
    </frontend>
</config>

and Observer.php

<?php
class Luisvalencia_Affiliate_Model_Observer
{
    const COOKIE_KEY_SOURCE = 'luisvalencia_affiliate_source';

    public function captureReferral(Varien_Event_Observer $observer)
    {
        $referrer=Mage::app()->getRequest()->getServer('HTTP_REFERER');
        Mage::getSingleton('core/session')->setReferrer($referrer);
        $outputMessage = Mage::getSingleton('core/session')->getReferrer();
        echo $this->__($outputMessage);
    }

    protected function _getCookieLifetime()
    {
        $days = 1;
        // convert to seconds
        return (int)86400 * $days;
    }
}

However I still see this on system.log, I dont understand.

2014-08-13T15:50:17+00:00 ERR (3): Warning: include(Mage/Luisvalencia/Affiliate/Model/Observer.php): failed to open stream: No such file or directory  in /home/theprint/public_html/preprod/lib/Varien/Autoload.php on line 93
2014-08-13T15:50:17+00:00 ERR (3): Warning: include(Mage/Luisvalencia/Affiliate/Model/Observer.php): failed to open stream: No such file or directory  in /home/theprint/public_html/preprod/lib/Varien/Autoload.php on line 93
2014-08-13T15:50:17+00:00 ERR (3): Warning: include(): Failed opening 'Mage/Luisvalencia/Affiliate/Model/Observer.php' for inclusion (include_path='/home/theprint/public_html/preprod/app/code/local:/home/theprint/public_html/preprod/app/code/community:/home/theprint/public_html/preprod/app/code/core:/home/theprint/public_html/preprod/lib:.:/usr/lib/php:/usr/local/lib/php')  in /home/theprint/public_html/preprod/lib/Varien/Autoload.php on line 93


texts: How to check if data is updated in an observer model

texts:
I want to check if the magento admin ->system -> configuration -> payment methods is updated. i have hooked with admin_system_config_changed_section_payment. It is behaving well. In observer.php i want to check if any of payment methods have been updated? hasDataChanges() is returing always 1, $observer->getOrigData() is returning empty array. as below

Varien_Event_Observer Object
(
    [_data:protected] => Array
        (
            [event] => Varien_Event Object
                (
                    [_observers:protected] => Varien_Event_Observer_Collection Object
                        (
                            [_observers:protected] => Array
                                (
                                )

                        )

                    [_data:protected] => Array
                        (
                            [website] =>
                            [store] =>
                            [name] => admin_system_config_changed_section_payment
                        )

                    [_hasDataChanges:protected] =>
                    [_origData:protected] =>
                    [_idFieldName:protected] =>
                    [_isDeleted:protected] =>
                    [_oldFieldsMap:protected] => Array
                        (
                        )

                    [_syncFieldsMap:protected] => Array
                        (
                        )

                )

            [website] =>
            [store] =>
        )

    [_hasDataChanges:protected] => 1
    [_origData:protected] =>
    [_idFieldName:protected] =>
    [_isDeleted:protected] =>
    [_oldFieldsMap:protected] => Array
        (
        )

    [_syncFieldsMap:protected] => Array
        (
        )

)


texts: Magento2 - InstallData Cms Page with content from file

texts:
as the title suggests

I'm creating a module that programmatically installs pages on cms_page,
my problem arises when I want to load the contents of a phtml file and pass it as html into the array to fill the content index ...

I have not very clear the path of where to put the phtml file and how to recall it indicating that path ....

example of the current structure

app
 | - code
 |    |- MyVendor
 |        |- MyModule
 |            |- registration.php
 |            |- etc
 |                |- module.xml
 |            |- Setup
 |                 |- InstallData.php
 |            |- view
 |                 |- frontend
 |                      |- templates
 |                           |- homepage.phtml

is the above path right?
who can write me the path of where to insert the phtml files and how to recall them?

namespace MyVendor\MyModule\Setup;
use Magento\Cms\Model\PageFactory;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
class InstallData implements InstallDataInterface
{
private $pageFactory;

public function __construct(PageFactory $pageFactory)
{
    $this->_pageFactory = $pageFactory;
}

/**
 * Installs data for a module
 *
 * @param ModuleDataSetupInterface $setup
 * @param ModuleContextInterface $context
 * @return void
 * @throws \Exception
 */
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
    // Load cms page by identifier
    $cmsPage = $this->_pageFactory->create()->load('home-page', 'identifier');

    $content = '<div id="something">
                {{block class="Magento\Framework\View\Element\Template" name="home-page" template="app/code/MyVendor/MyModule/view/frontend/templates/homepage.phtml" }}
                </div>';

    // Create CMS Page
    if (!$cmsPage->getId()) {
        $cmsPageData = [
            'title' => 'Custom cms page', // cms page title
            'page_layout' => '1column', // cms page layout
            'meta_keywords' => 'Page keywords', // cms page meta keywords
            'meta_description' => 'Page description', // cms page description
            'identifier' => 'home-page', // cms page url identifier
            'content_heading' => 'Custom Home page', // Page heading
            'content' => $content, // page content
            'is_active' => 1, // define active status
            'stores' => [0], // assign to stores
            'sort_order' => 0 // page sort order
        ];

        $this->_pageFactory->create()->setData($cmsPageData)->save();
    }
}
}

After apply the suggested changes
RETURN ERROR:

main.CRITICAL: Invalid template file: 'app/code/MyVendor/MyModule/view/frontend/templates/homepage.phtml' in module: '' block's name: 'magento\framework\view\element\template_0' {"exception":"[object] (Magento\\Framework\\Exception\\ValidatorException(code: 0): Invalid template file: 'app/code/MyVendor/MyModule/view/frontend/templates/homepage.phtml' in module: '' block's name: 'magento\\framework\\view\\element\\template_0' at /var/www/html/vendor/magento/framework/View/Element/Template.php:277)"} []


texts: Multi-Store Magento - On CDN - Possible?

texts:
I have a multi-store magento install.
I have a CDN with Trustwave.

Currently I have only setup 1 store on the trustwave CDN.
And have changed that one store's DNS to point to the CDN.

Do you think it is possible for me to point the other URLs to that CDN as well?
Or do I have to get a new CDN per URL (even though all my stores are on the same server/ip/magento install)?


texts:
I have downloaded and installed Magento 2 from https://github.com/magento/magento2

But I am getting 404 error for scripts and cs located in http://localhost/magento2/pub/static/

I have checked, Apache rewrite engine is on. But still, css and js file are not loading.

When I try to access a file directly from the browser it gives following exception.

Cannot create a symlink for "D:/xampp/htdocs/magento2/lib/web/mage/calendar.css" and place it to "D:/xampp/htdocs/magento2/pub/static/frontend/Magento/blank/en_US/mage/calendar.css" Warning!symlink(): Cannot create symlink, error code(1314)
#0 D:\xampp\htdocs\magento2\lib\internal\Magento\Framework\Filesystem\Directory\Write.php(155): Magento\Framework\Filesystem\Driver\File->symlink('D:/xampp/htdocs...', 'D:/xampp/htdocs...', Object(Magento\Framework\Filesystem\Driver\File))
#1 D:\xampp\htdocs\magento2\lib\internal\Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink.php(30): Magento\Framework\Filesystem\Directory\Write->createSymlink('lib/web/mage/ca...', 'frontend/Magent...', Object(Magento\Framework\Filesystem\Directory\Write))
#2 D:\xampp\htdocs\magento2\lib\internal\Magento\Framework\App\View\Asset\Publisher.php(65): Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink->publishFile(Object(Magento\Framework\Filesystem\Directory\Write), Object(Magento\Framework\Filesystem\Directory\Write), 'lib/web/mage/ca...', 'frontend/Magent...')
#3 D:\xampp\htdocs\magento2\lib\internal\Magento\Framework\App\View\Asset\Publisher.php(49): Magento\Framework\App\View\Asset\Publisher->publishAsset(Object(Magento\Framework\View\Asset\File))
#4 D:\xampp\htdocs\magento2\lib\internal\Magento\Framework\App\StaticResource.php(118): Magento\Framework\App\View\Asset\Publisher->publish(Object(Magento\Framework\View\Asset\File))
#5 D:\xampp\htdocs\magento2\lib\internal\Magento\Framework\App\Bootstrap.php(245): Magento\Framework\App\StaticResource->launch()
#6 D:\xampp\htdocs\magento2\pub\static.php(13): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\StaticResource))
#7 {main}

My operating system is Windows 7 and I am running xampp server.


texts: How to convert round number to decimal point number in pdf invoice.


texts: Magento 2.1.7 add CMS page multiselect to CMS page

texts:
I'm new to Magento 2 and I'm trying to add a multiselect of all (for now) CMS pages to the CMS pages in Magento 2. What I mean by this is that when creating/editing a CMS page, there should be an extra field with all (other) CMS pages from which you can select multiple (or just one or none at all), just like you have a multiselect for the Store View field.
I have got it to work to render the multiselect and you can select multiple, but upon saving it shows a message that "something" went wrong.
Example of the fields:

I've also created an upgrade script which has successfully created an extra field in the cms_page table. I can still save pages, but only when I don't select any CMS pages.

Here's my //view/adminhtml/ui_component/cms_page_form.xml

<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="search_engine_optimisation">
        <field name="redirect_to">
            <argument name="data" xsi:type="array">
                <item name="options" xsi:type="object">Magento\Cms\Model\Config\Source\Page</item>
                <item name="config" xsi:type="array">
                    <item name="dataType" xsi:type="string">int</item>
                    <item name="label" xsi:type="string" translate="true">Redirect to pages</item>
                    <item name="formElement" xsi:type="string">multiselect</item>
                    <item name="source" xsi:type="string">page</item>
                    <item name="dataScope" xsi:type="string">redirect_to</item>
                    <item name="default" xsi:type="string">0</item>
                    <item name="validation" xsi:type="array">
                        <item name="required-entry" xsi:type="boolean">false</item>
                    </item>
                </item>
            </argument>
        </field>
    </fieldset>
</form>

What am I missing or doing wrong? For some reason, I've gotten it to work but it would only save one, never multiple, but I can't seem to reproduce that anymore.

What I'd like to achieve is for it to save all selected options as a JSON encoded string with the store id as key and the URL as value. How would I go about doing this?

Any help is much appreciated.


texts: Magento2: How to get invoice pdf as response through magento rest api?

texts:
I want to get the pdf invoice as response using magento rest api for mobile application.
I got the invoice order history data

My code:

public function printInvoicePdf(Request $request)
  {
    echo "testing";

    $validator = Validator::make($request->all(), [
        'invoice_id'  => 'required'
        //'token' => 'required'
    ]);
    if($validator->fails())
    {
      return response()->json(['error'=>$validator->errors()], 401);
    }

    else
    {

    $invoice_id=$request->invoice_id;
    //print_r($order_id);
    $get_admin_token=$this->authenticateMageAPI();
    //$apiURL=$this->API_URL."invoices/".$invoice_id."/pdf/".templateId."";
    $apiURL=$this->API_URL."invoices/".$invoice_id;

    //echo
    $headers = array("Authorization: Bearer ".$get_admin_token,'Content-Type: application/pdf');

    $ch = curl_init($apiURL);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

    // curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    //     "Authorization: Bearer ".$token
    // ));
    $result = curl_exec($ch);
    $response_get = json_decode($result);
    if(isset($response_get->message))
      {
        echo "testing3";
        $respose    = array("error_code" => 1,"data"=>$response_get);
        $data_enode = json_encode($respose);
        echo  $data_enode;
      }
      else
        {

          echo "testing2";
            $respose    = array("error_code" => 0,"data"=>$response_get);
            $data_enode = json_encode($respose);
            echo  $data_enode;
        }
    }
  }

Any help would be appreciated


texts: How to check the product image is available or not in magento 2

texts:
I am getting my product collection like this.to show i n a slider in home page.

public function getProductCollection($categoryId,$filter_attribute)
{

    $category = $this->_categoryFactory->create()->load($categoryId);
    $collection = $this->_productCollectionFactory->create();
    $collection->addAttributeToSelect('*');
    $collection->addAttributeToFilter($filter_attribute, 1);

    $collection->addCategoryFilter($category);
    $collection->addAttributeToFilter('visibility', \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH);
    $collection->addAttributeToFilter('status',\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED);
    return $collection;
}

I can get the products from this in my slider.
I want to call place holder image if the product haven't updated with any image.

I tried this way.

$image_have =  strcmp($product->getImage(),'no_selection');
if($image_have != 0){
    $productImageUrl = $productImageUrl;//this is image url
}else{
    $productImageUrl = $PlaceholderImage;//this is place holder image url
}

If i add a product without uploading product image the place holder image is not showing.
Some time $product->getImage() this return empty. Is there any way to check the product has an image or not.


texts: How to get Country ID from Country Name in Magento1.9.2.4?

texts:
I want to get country_id from the country name in Magento, Please suggest how can I achieve this.
I found these database tables but they are not helpful:

directory_country
directory_country_region
directory_country_region_name


texts:
I currently have an issue with a module output. I am currently using v.1.9.3.4

The extension module in question is shown as "Disabled" however the configuration in the extension shows "Enabled".

I can enable the module but as soon as I press Save it returns back to disabled.

Even if I try to enable this using code or via the database it seems to automatically disable itself once the change has executed.

Anyone else had this issue?


texts: Magento 2.0.1 problem with my custom theme

texts:
I am using Magento 2.0.1 and I created a custom theme in app\design\frontend\MyTheme

Now, I am setting my custom theme in back end and I created following folders and files

\web

\media

\etc

registration.php

theme.xml

After this, I pasted the folders of Magento_Module

from \vendor\magento\theme-blank of Magento_Module to app\design\frontend\mytheme.

My structure is app/design/frontend/vendor_name/theme_name.

In this folder I have three folders: \etc \media \web and other two files registration.php and theme.xml.

The problem is that I can not understand why the files phtml template Magento can not read them from path of my theme. Magento reads files phtml of the site only in this path \vendor\magento\magento_module.

Why this?

Thank you very much.


texts: How to find the file in getchildhtml('customer') in magento 2

texts:
How i find this file and i want to add some fields here

 <?php echo $block->getChildHtml('customer_form_register_layout3');?>

i search in

app/design/theme/childtheme/custom module

but not found here

how to find $block->getChildHtml('Cusomer_form_register_layyout3')

and what is getChildHtml()


texts:
suddenly our mysql, shutdowns more and more.

I get this error: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

And I have to restart the mysqld service.

Can someone please help me with this?

We got 18000 products 3000 categories, and probably 5000 visitors daily.

my.cnf =

max_allowed_packet = 15000M
innodb_buffer_pool_size = 6G
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 100M
server-id=2
max_connections = 1024

Btw here is my last mysql error log:

  151120 10:39:35 mysqld_safe mysqld from pid file
  /var/run/mysqld/mysqld.pid ended

  151120 10:39:55 mysqld_safe Starting mysqld daemon with databases from
  /data/mysql/datafiles

  151120 10:39:55 [Warning] option 'max_allowed_packet': unsigned value

  15728640000 adjusted to 1073741824

  151120 10:39:55 [Note] Plugin 'FEDERATED' is disabled.

  151120 10:39:55 InnoDB: The InnoDB memory heap is disabled

  151120 10:39:55 InnoDB: Mutexes and rw_locks use GCC atomic builtins

  151120 10:39:55 InnoDB: Compressed tables use zlib 1.2.3

  151120 10:39:55 InnoDB: Using Linux native AIO

  151120 10:39:55 InnoDB: Initializing buffer pool, size = 6.0G

  InnoDB: mmap(6593445888 bytes) failed; errno 12

  151120 10:39:55 InnoDB: Completed initialization of buffer pool

  151120 10:39:55 InnoDB: Fatal error: cannot allocate memory for the
  buffer pool

  151120 10:39:55 [ERROR] Plugin 'InnoDB' init function returned error.

  151120 10:39:55 [ERROR] Plugin 'InnoDB' registration as a STORAGE
  ENGINE  failed.

  151120 10:39:55 [ERROR] Unknown/unsupported storage engine: InnoDB

  151120 10:39:55 [ERROR] Aborting


texts: Magento 2 How to add Delivery date function in both admin and frontend

texts: In magento 2 I need to add Delivery date option in both frontend page and admin page. Is it possible to update by the code?


texts: CollectionFactory get image, thumbnail, small_image are the same

texts:
In my custom block, I get Product Collection use \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory, when I output one product in it, the image, thumbnail, small_image are the same url like below, a large image(1380px x 1340px) url：

[image] => /m/b/mb04-black-0.jpg
[small_image] => /m/b/mb04-black-0.jpg
[thumbnail] => /m/b/mb04-black-0.jpg

Did I do something wrong? How do I get the real small_image or thumbnail URL from product collection?

More question description

For example, in the default luma theme category, product list always get the image like below:

<img class="product-image-photo" src="http://local.com/pub/media/catalog/product/cache/small_image/240x300/beff4985b56e3afdbeabfc89641a4582/w/t/wt09-white_main.jpg" width="240" height="300" alt="Breathe-Easy Tank">

How can I get that?

My code example

Below is my code, I remove some function for simplicity.

<?php
namespace Vendor\Template\Block;

use Magento\Framework\View\Element\Template;
use Magento\Backend\Block\Template\Context;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;

class Product extends Template
{
    protected $_productCollectionFactory;

    public function __construct(
        Context $context,
        CollectionFactory $productCollectionFactory,
        array $data = []
    )
    {
        $this->_productCollectionFactory = $productCollectionFactory;
        parent::__construct($context, $data);
    }

    public function getProductCollection()
    {
        $skus = $this->getData('products_count');
        $collection = $this->_productCollectionFactory->create();
        $collection->addAttributeToSelect('*')
            ->addAttributeToFilter(
                'sku', array('in' => $skus)
            );
        return $collection;
    }
}


texts: Missing cached stylesheet for Magento 2 Theme

texts:
We are using the free HiddenTechies theme "Bizkick" for our Magento 2 store and we are having an issue with a missing stylesheet.

On the front page, the theme is displaying correctly except for two blocks toward the bottom; the problem seems to be caused by a missing stylesheet.

In the browser console, I receive this error:

(index):1 Refused to apply style from 'https://our-magento-site.org/pub/static/version1591889861/frontend/Hiddentechies/bizkick/en_US/css/whitedemo.css' because its MIME type ('text/plain') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

When I try to open https://our-magento-site.org/pub/static/version1591889861/frontend/Hiddentechies/bizkick/en_US/css/whitedemo.css in the browser, I get the following (php?) error message:

Compilation from source: LESS file is empty: frontend/Hiddentechies/bizkick/en_US/css/whitedemo.less
<pre>#1 Magento\Framework\View\Asset\PreProcessor\AlternativeSource->processContent('css/whitedemo.cs...', '', '', &Magento\Framework\View\Asset\File\FallbackContext#0000000036e858b600000000403d0061#) called at [vendor/magento/framework/View/Asset/PreProcessor/AlternativeSource.php:114]
#2 Magento\Framework\View\Asset\PreProcessor\AlternativeSource->process(&Magento\Framework\View\Asset\PreProcessor\Chain#0000000036e858aa00000000403d0061#) called at [vendor/magento/module-developer/Model/View/Asset/PreProcessor/PreprocessorStrategy.php:76]
#3 Magento\Developer\Model\View\Asset\PreProcessor\PreprocessorStrategy->process(&Magento\Framework\View\Asset\PreProcessor\Chain#0000000036e858aa00000000403d0061#) called at [vendor/magento/framework/View/Asset/PreProcessor/Pool.php:77]
#4 Magento\Framework\View\Asset\PreProcessor\Pool->process(&Magento\Framework\View\Asset\PreProcessor\Chain#0000000036e858aa00000000403d0061#) called at [vendor/magento/framework/View/Asset/Source.php:152]
#5 Magento\Framework\View\Asset\Source->preProcess(&Magento\Framework\View\Asset\File#0000000036e858b500000000403d0061#) called at [vendor/magento/framework/View/Asset/Source.php:105]
#6 Magento\Framework\View\Asset\Source->getFile(&Magento\Framework\View\Asset\File#0000000036e858b500000000403d0061#) called at [vendor/magento/framework/View/Asset/File.php:158]
#7 Magento\Framework\View\Asset\File->getSourceFile() called at [vendor/magento/framework/App/StaticResource.php:135]
#8 Magento\Framework\App\StaticResource->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]
#9 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\StaticResource#0000000036e8586700000000403d0061#) called at [pub/static.php:13]
</pre>

I have tried clearing the cache, as well as using these console commands but the issue hasn't been fixed:

php bin/magento setup:static-content:deploy -f

php bin/magento setup:static-content:deploy en_US -f

Any advice on how to fix this?


texts:
i want to disable SKU in .phtml-file and i don't know where i can find the phtml-file that includes SKU. Please can somebody tell me whats the path to the file that includes phtml with SKU.
Or if you have suggestion to delete it easier let me know, but in any case i want to know where the .phtml-file is, that include SKU. Path hints on developer doesn't show!

Thanks


texts: Problem with Magento category description! please help

texts:
My category description above (before the goods).
I wish to change the location of the category description. This should be at the bottom (after the goods).
I am using magento commerce 1.9


texts: Magento2 Moving minicart to sidebar removing ajax

texts:
this is my minicart.phtml file, now I've placed it in the sidebar it shows an ajax popup link instead of displaying the minicart itself. How can I edit this code to just let it show directly in the sidebar?

<?php
/** @var $block \Magento\Checkout\Block\Cart\Sidebar */
?>

 <a class="action showcart" href="<?php echo $block->getShoppingCartUrl(); ?>"
   data-bind="scope: 'minicart_content'">
    <?php echo __('Shopping Cart'); ?>

        0

<?php if ($block->getIsNeedToDisplaySideBar()): ?>

<?php endif ?>


texts:
I am written the code for Recent Viewed Products on footer.phtml, but it's not showing.

my code is:

local.xml

<?xml version="1.0" encoding="UTF-8"?>

<layout>
    <default>

        <reference name="root">
            <action method="setTemplate">
                <template>page/2columns-left.phtml</template>
                <action method="setIsHandle">
                    <applied>1</applied>
                </action>
            </action>
        </reference>

        <remove name="right.poll"/>
        <remove name="right.permanent.callout"/>
        <remove name="left.permanent.callout"/>
        <remove name="paypal.partner.right.logo"/>
        <remove name="cart_sidebar"/>
 <reference name="footer">
            <block type="reports/product_viewed" name="product.recently.viewed" as="product_recently_viewed"
                                         template="reports/product_viewed.phtml"/>
        </reference>

    </default>

footer.phtml

                <?php echo $this->getChildHtml('product_recently_viewed') ?>

shopper/default/template/reports/product_viewed.phtml

<?php
ob_start();

/* @var $this Mage_Reports_Block_Product_Viewed */

$helper = $this->helper('shoppersettings/image');
$imgX = 56;
$imgY = $helper->calculateHeight($imgX);
$_helper = $this->helper('catalog/output');
?>
<?php if ($_products = $this->getRecentlyViewedProducts()): ?>

        <?php echo $this->__('Recently Viewed Products') ?>

            <?php foreach ( $_products as $_product ) : ?>

                <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image">
                    <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($imgX, $imgY) ?>" data-srcX2="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($imgX*2, $imgY*2) ?>" width="<?php echo $imgX; ?>" height="<?php echo $imgY; ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" />

                    <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
                    <a class="product-name" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?>
                    <?php echo $this->getPriceHtml($_product, true) ?>

            <?php endforeach; ?>

<?php endif; ?>
<?php
$queldorei_blocks = Mage::registry('queldorei_blocks');
if ( !$queldorei_blocks ) {
$queldorei_blocks = array();
} else {
    Mage::unregister('queldorei_blocks');
}
$queldorei_blocks['block_viewed'] = ob_get_clean();
Mage::register('queldorei_blocks', $queldorei_blocks);

can you tell me where i went wrong?

Thanks in advance.


texts: css issue for including wrong links like /home/user/public_html/skin/

texts: I am using a custom theme for my Magento store with a bunch of custom modules. Everything works correctly 99% of the time, but as I enable js and css minified mode. When that's done some css paths change to /home/user/public_html/skin/. and an error occurs not found and frontend not opens.


texts: I have created a module to push magento information to OroCRM for Magento 2. Each item is saved on a grid and pushed using cron tasks. All this is working fine. Now I have added an admin notification on the back-end to inform the user when errors are found. I have a link to the same grid on the notification. However I need to set a filter show only the items with errors (I have the IDs of them). Any ideas how to set a filter (not default) to an admin grid (Ui Component) from an action?


texts: How to upload extension on magento connect?

texts:
I have created a extension and want to upload on magento connect but when I upload it on magento connect it gives me following error:-

Unable to save version. Filename is not valid. Expected filename without ext...

I checked my extension which is working great on all versions.

Please help me to sort out this error.


texts: Change what attributes are returned from Mage_Sales_Model_Quote_Item::getProduct()

texts:
Really the title explains it!

I'm trying to perform some extra checks on products in the cart, however in order to do so I need to grab some extra attributes from the product.

Calling

 $item->getProduct()

only returns a small subset of the product's attributes, and doesn't include what I need.

At the moment, I'm re-loading the product using

 Mage::getModel('catalog/product')->load($item->getProductId());

but this seems a really in-efficient way of doing it.

Is there a way to add extra attributes to the

 $item->getProduct()

call without extending the class method?

Thanks!


texts: Hello I would like to obtain a csv file containing the list of products (Order ID, EAN code and quantity) present in the orders whose status is being processed. How to proceed ?


texts: Magento 2 - Do not scroll to invalid field on form validation

texts:
On the log in page, when I don't input input in fields, the error message displays focusing on the invalid input. The window scrolls upto the invalid field at the same time.

I do not want the window to scroll.
Where can I find the code for scrolling?


texts: My e-commerce website (Magento) working in Ubuntu but not in Windows, showing adobe flash outdated error

texts:
Can anybody please help me.

My e-commerce website (Magento) working in Ubuntu but not in Windows system. When i am going to any product, its showing adobe flash plugin is outdated error.

What should I do??

How to update the flash plugin in Magento 1.9.2.4

This is not a browser issue. I have tried in Chrome, Mozilla etc. It's working but when I browse any product it goes to error page.


texts:
We need to extend the Store Group model a bit by adding a couple of fields, needed mostly for external integrations. Following the example here we've added the extra columns to the database. Now we need to extend the input form to populate the fields from Magento admin as well.

I'm only able to find information about the EAV model, but from what I understand that isn't supported here. How should I go about extending the input form?


texts:
I want to remove some items from a page when certain conditions apply. I got a solution but I'm wondering if there isn't any better way to do this.

Now the code that I have is for each block that I want to remove:

 protected function _toHtml() {
    if ($condition) {
      return '';
    }

    return parent::_toHtml();
 }

Now I was wondering if ther is a way to remove a container from the layout file instead of doing this for every block inside a single container. I tried something like this but it does not work:

protected function _toHtml() {
    if ($condition) {
      $this->getLayout()->removeOutputElement('container.name.in.layout');
      return '';
    }

    return parent::_toHtml();
  }

Anyone know's how to remove containers form the layout page within a block class, thanks.


texts: Magento paypal standard redirects only to blank page

texts:
After having installed a theme which does not interfere with the checkout except for some css formatting, the customer gets not redirected to paypal anymore but ends up at a blank page: /paypal/standard/redirect/

Nothing is written to the log files. The paypal module is enabled in config-advanced.

Magento version 1.9.0.1

I have no idea what the reason could be


texts: Magento 2.0.2 enterprise front(Customer) login not working

texts: I have magento enterprise version and getting issues with login process. When i processed for login not getting any message and also got the issue which automatically product remove from cart. i am using magento 2.0.2 enterprise version. Please improve this answer thanks.


texts: Magento1 - How to send a encrypted format of user id in url?

texts:
I want to send encrypted use id to URL. I m getting guest user id through ajax onchange function but on send mail to a user it should be encrypted.

<?php

require_once 'app/Mage.php';
 Mage::app();
 umask(0);

$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');
//$query = "SELECT * FROM toots4trade_guest_user_track WHERE customer_status=0";
$query = "SELECT * FROM toots4trade_guest_user_track WHERE customer_status = 0 ";
$results = $readConnection->fetchAll($query);

foreach($results as $row){
    $guest_user_id = $row['customer_id'];
     $emailId = $row['customer_email'];

    $url ="http://stage.tools4trade.co.uk/create_cart.php?guest_user_id=".$guest_user_id;
    mail($emailId,"Abandon Cart",$url);

    $query = "UPDATE toots4trade_guest_user_track SET customer_status = 1 WHERE customer_email ='{$emailId}'";
        $results = $readConnection->fetchAll($query);
        }


texts: Can't get Paliarush Magento 2 Vagrant for developers to switch to EE mode

texts: Please see my issue report on github for extreme details.


texts: Magento 2.3.3 on Centos 7 with Nginx using composer - Website not working?

texts:
Following tutorial : https://devdocs.magento.com/guides/v2.3/install-gde/composer.html

After download magento by using,

composer create-project --repository=https://repo.magento.com/ magento/project-community-edition=2.3.3 magento

Folder path : var/ww/html/magento

I am using centos 7 - Nginx how to run following last 2 commands,

find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
chown -R :www-data . # Ubuntu
chmod u+x bin/magento

Finally my installation command,

bin/magento setup:install –base-url=http://127.0.0.1/magento –db-host=localhost –db-name=magento –db-user=root –db-password=P@ssword123 –admin-firstname=mage –admin-lastname=mage --admin-email=mage@gmail.com –admin-user=mage –admin-password=mage@123 –language=en_US –currency=INR –timezone=Asia/Kolkata –use-rewrites=1

How to setup magento.conf in etc/nginx/config.d/ magento.conf?

my magento.conf :

upstream fastcgi_backend {
     server  127.0.0.1:9000;
 }

 server {

     listen 8085;
     server_name 192.168.1.65:8085;
     set $MAGE_ROOT /var/www/html/magento;
     include /var/www/html/magento/nginx.conf.sample;
 }

In url section if i type 192.168.1.65:8085 getting blank page.

FYI - After install magento 2.3.3 not created env.php file under \app\etc.


texts: How to add canonical tag for all cms pages magento 2?

texts:
I want to add canonical tag for all cms pages. Currently canonical tag enabled for category and product page.

How to do this?


texts: customer user name displayed on header bar when user logged out by session time automatically

texts:
I am building the magento 2.4 website
By the way I am facing with below customer login issue
"I had logged into the website with customer account
I spent some times and I visited the site by the way username is displaying and no logout button, login button is displaying - I am pretty sure that this user account is logged out automatically by session
Why is this user account name displaying still?
I had tried to purge all history and cookie of the chrome browser in chrome browser clear section
And I had tried to do
OK this account name is appeared
Anyway I don't know why this account user name is displaying always before history of the chrome browser is cleared

my actions
step 1:

step 2:
I had logged into the site

step 3:
After 10 min I refresh the browser

step 4:
clear all data in chrome browser

step 5:

How can I set or fix this issue
Hope to help for this issue
Thank you so much


texts: How to get specific value from attribute over the all

texts:
Image(1).This is my code to get attribute values.
Image(2).It shows the values from particular attribute like color,it showing all the color's inside the color attribute.
Image(3). I need to get these three values only.How can i get it...???
[1]: https://i.stack.imgur.com/Xvj3T.png
[2]: https://i.stack.imgur.com/zfqDA.png
[3]: https://i.stack.imgur.com/7jlDv.png


texts:
I've been searching for a possible answer to this, and my eyeballs are blurry. I want to override Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Checkbox, and have written a class:

class MyModule_MyProject_Block_Adminhtml_Widget_Grid_Column_Renderer_Checkbox extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Checkbox

My config file entry for this is:

<blocks>
  <adminhtml>
    <rewrite>
      <widget_grid_column_renderer_checkbox>
         MyModule_MyProject_Adminhtml_Block_Widget_Grid_Column_Renderer_Checkbox
      </widget_grid_column_renderer_checkbox>
    </rewrite>
  </adminhtml>
</blocks>

I have other blocks overridden successfully, but this one won't drop into my code. Can anyone see something wrong with this? Can this renderer be subclassed?


texts: PayPal IPN not triggering Order Status updates

texts:
I'm setting up my first Magento system, using 1.8.0.0, running on a HostGator Windows server.

I've configured IPN on our PayPal account.  However, the payments never get communicated to Magento, and all orders are stuck at "Pending Payment".

Currently, System->Configuration->Payment Methods ->PayPal Payments Standard is associated with the Business Sandbox email, has Payment Action set to "Sale", Sandbox Mode = "Yes", and Debug Mode = "Yes".

On PayPal's side, the IPN History shows each transaction (I've tried in both Sandbox and Production) as "Retrying".  There is no HTTP Response Code listed for any of them.

The Notification URL in PayPal shows http://www.mydomain.com:/shop/Index.php/paypal/ipn/, which appears correct to me.

After turning on error logs and debug mode for the payment method, I get a log file for my sandbox attempt entitled payment_paypal_standard.log.

The contents of the file reflect the actual sandbox order:

2014-01-02T18:19:13+00:00 DEBUG (7): Array

(

[request] => Array
    (
        [business] => ****
        [invoice] => 100000006
        [currency_code] => USD
        [paymentaction] => sale
        [return] => https://www.mydomain.com/shop/Index.php/paypal/standard/success/
        [cancel_return] => https://www.mydomain.com/shop/Index.php/paypal/standard/cancel/
        [notify_url] => http://www.mydomain.com:/shop/Index.php/paypal/ipn/
        [bn] => Varien_Cart_WPS_US
        [item_name] => My Shopping Cart
        [lc] => en_US
        [charset] => utf-8
        [amount] => 7.99
        [tax] => 0.00
        [shipping] => 5.00
        [discount_amount] => 0.00
        [item_number_1] => Bacon4NFHS
        [item_name_1] => Bacon - Nitrate Free Hickory Smoked 4 oz.
        [quantity_1] => 1
        [amount_1] => 2.99
        [item_number_2] => Flat Rate - Fixed
        [item_name_2] => Shipping
        [quantity_2] => 1
        [amount_2] => 5.00
        [cmd] => _cart
        [upload] => 1
        [tax_cart] => 0.00
        [discount_amount_cart] => 0.00
        [city] => recipient_city
        [country] => US
        [email] => sandbox_customer_email@test.com
        [first_name] => customer_fname
        [last_name] => customer_lname
        [zip] => customer_zip
        [state] => customer_state
        [address1] => customer_address1
        [address2] =>
        [address_override] => 1
    )

[__pid] => 5440
)

I'm new to both PayPal IPN and Magento, so I may be making an obvious mistake, but I've also been having a ton of problems with the Magento install that were caused by problems with the auto-installer package HostGator provided.

Why are my payments not getting recorded by Magento?


texts: Where is this function getRowTaxDisplayPrecision() written?

texts:
I have checked all over the place, but couldn't locate getRowTaxDisplayPrecision() function. This is referenced in following function:

class  Mage_Adminhtml_Block_Sales_Items_Abstract

/**
     * Retrieve price attribute html content
     *
     * @param string $code
     * @param bool $strong
     * @param string $separator
     * @return string
     */
    public function displayPriceAttribute($code, $strong = false, $separator = '<br />')
    {
        if ($code == 'tax_amount' && $this->getOrder()->getRowTaxDisplayPrecision()) {
            return $this->displayRoundedPrices(
                $this->getPriceDataObject()->getData('base_'.$code),
                $this->getPriceDataObject()->getData($code),
                $this->getOrder()->getRowTaxDisplayPrecision(),
                $strong,
                $separator
            );
        } else {
            return $this->displayPrices(
                $this->getPriceDataObject()->getData('base_'.$code),
                $this->getPriceDataObject()->getData($code),
                $strong,
                $separator
            );
        }
    }

If the function is not defined then why it doesn't throw any error?

What did I miss?


texts: Magento 2: Override Magento\Catalog\Block\Product\View Block

texts:
I have developed one custom module and i have tried to override product view block by following these two links Overriding Block in Magento 2
and DI & Extending a Block on Magento 2 but when i hit product view page its gives me 404 page. what i have done so far is below

di.xml

  <?xml version="1.0"?>
   <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
       <preference for="Magento\Catalog\Block\Product\View" type="TT\Helloworld\Block\Myproduct"/>
   </config>

Myproduct.php

<?php
namespace TT\Helloworld\Block;

use Magento\Framework\View\Element\Template;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Catalog\Model\Product;
class Myproduct extends \Magento\Catalog\Block\Product\View
{

protected $_helper;

protected $_objectManager;

public function __construct(
        \Magento\Catalog\Block\Product\Context $context,
        \Magento\Framework\Url\EncoderInterface $urlEncoder,
        \Magento\Framework\Json\EncoderInterface $jsonEncoder,
        \Magento\Framework\Stdlib\StringUtils $string,
        \Magento\Catalog\Helper\Product $productHelper,
        \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig,
        \Magento\Framework\Locale\FormatInterface $localeFormat,
        \Magento\Customer\Model\Session $customerSession,
        ProductRepositoryInterface $productRepository,
        \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency,
        array $data = [],
        \TT\Helloworld\Helper\Data $helper
) {
    parent::__construct($context, $urlEncoder, $jsonEncoder, $string, $productHelper, $productTypeConfig, $localeFormat, $customerSession, $productRepository, $priceCurrency, $data,$helper);

    $this->_helper = $helper;

}

protected function _toHtml()
{
    $this->setModuleName($this->extractModuleName('Magento\Catalog\Block\Product\View'));
    return parent::_toHtml();
}

As per DI & Extending a Block on Magento 2 link i have also included all the parent class construct parameter in Myproduct.php constructer.

anyone one know where i'm wrong? or what is the correct way to override this?


texts: Magento 2: Use of ObjectManager in Controller

texts:
Let's say I want to load a order item in a controller. I can use:

$order = $this->_objectManager->create('Magento\Sales\Model\Order\item')->load($id);

I see this happening in a lot of free and commercial modules. Even do everywhere on the forums they say Object manager is discouraged. Should I still use a service contract, even do the code is much more complex?

<?php namespace Xxx\xxx\Helper;

class GetOrderItemById
{
  private $orderRepository;
  private $searchCriteriaBuilder;

  public function __construct(
    \Magento\Framework\App\Helper\Context $context,
    \Magento\Sales\Model\Order\ItemRepository $orderRepository,
    \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
  ){
    $this->orderRepository = $orderRepository;
    $this->searchCriteriaBuilder = $searchCriteriaBuilder;
  }

  function getOrderItem($id)
  {
    $searchCriteria = $this->searchCriteriaBuilder
      ->addFilter('id', $id, 'eq')->create();
    $orderItem = $this->orderRepository->getList($searchCriteria)->getItems();
  }
}

EDIT: I have edited my controller class:

<?php namespace Xxx\Xxx\Controller\Adminhtml\Save;

use Magento\Framework\Controller\ResultFactory;

class Index extends \Magento\Backend\App\Action
{
    private $orderRepository;
    private $searchCriteriaBuilder;

    public function __construct(
      \Magento\Sales\Model\Order\ItemRepository $orderRepository,
      \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
    ){
      $this->orderRepository = $orderRepository;
      $this->searchCriteriaBuilder = $searchCriteriaBuilder;
    }

    public function execute()
    {
      $post = $this->getRequest()->getPostValue();
      if (isset($post)) {

        $searchCriteria = $this->searchCriteriaBuilder
          ->addFilter('quote_item_id', $post['quote_item_id'], 'eq')->create();
        $orderItem = $this->orderRepository->getList($searchCriteria)->getItems();

        foreach ($orderItem as $item) {
          $return['item_id'] = ($item->getParentItemId() != NULL ? $item->getParentItemId() : $item->getId());
          $return['order_id'] = $item->getOrderId();
          var_dump($return);
        }
    }
}

It returns:

2018/08/05 19:03:39 [error] 19724#19724: *775254 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Qxs\SerialCode\Controller\Adminhtml\Save\Index::__construct() must be an instance of Magento\Sales\Model\Order\ItemRepository, instance of Magento\Backend\App\Action\Context given, called in /data/web/magento2_staging/generated/code/Qxs/SerialCode/Controller/Adminhtml/Save/Index/Interceptor.php on line 14 and defined in /data/web/magento2_staging/app/code/Qxs/SerialCode/Controller/Adminhtml/Save/Index.php:10


texts: How to upload free magento extension on magento connect?

texts:
This question may sound very noob, but I am having troubles finding how to upload free extension on magento connect. I have checked magento manuals and magento connect account interface and cannot find where to upload extension files.

I was reading following official magento PDF manual:
http://info.magento.com/rs/magentocommerce/images/packagingmagentoconnectextensions6%200.pdf

Section 3: Uploading Your Free Extension Package

  Once you’ve created your extension profile page with the information
  required in the section above, you will need to upload your extension
  package from the Versions Tab: NOTE: Remember – Your extension must be
  packaged under the username of the developer uploading the extension.
  Packaging in any other name will result in an error.

As you can see there is no "Browse" nor upload button.

Thanks for your help.

EDIT:

Here is 2 more screenshots of our account on magento connect (extension was approved 3 days ago)


texts: Magento 2 : How to save dynamic form data?

texts:
I am developing custom extension and add below form builder in admin side grid.

https://alloyui.com/examples/form-builder

Now I want to display this dynamic form in front end side but I do not know how to store this dynamic form in database and display in front end side.

For more understanding see below extension admin and front end form demo.

https://landofcoder.com/magento-2-form-builder.html

Thanks in advance...!


texts: Magento dropdown attribute default value

texts:
As I found the option box default value in magento here:

/app/design/frontend/default/mytheme/template/catalog/product/view/type/options/configurable.phtml

<select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
<option><?php echo $this->__('Choose an Option...') ?></option>
</select>

It shows 'Choose an Option...' as a default value

I try

<script>
 $(function() {
 $("#attribute525 option:first-child").attr("selected", true); //color
 $("#attribute272 option:first-child").attr("selected", true); //size
});
</script>

to make the default value each attribute set to the first option of each attribute,

but it doesn't work. Any suggestion will be appreciated, thanks.


texts:
I just saw that Magento is going to deprecate load and save functions which we use in loading and saving models. Can someone provide some insights on this?
What alternate we will be having now to use?


texts: Magento2 : How to check a product is available in Store Using SKU

texts:
I am able to updated the product price and Quantity. before that i wanted to check if product is available in store or not.

Here is the code of updating Price and Stock.

public function updateProduct($product_id, $price, $qty1){

       ini_set('max_execution_time', 0);
       $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
       $objectManager = $bootstrap->getObjectManager();
       $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
       $state = $objectManager->get('\Magento\Framework\App\State');
       $state->setAreaCode('frontend');
       $storeId = '1'; //Store ID

       $productFactory = $objectManager->get('\Magento\Catalog\Model\ProductFactory');

       $product = $productFactory->create();
       $prduct_id_sku = $product->load($product->getIdBySku($product_id));

       $oldprice = $product->getPrice();
       $productName = $product->getName();

       $oldstock = $StockState->getStockQty($product->getId());

       if (($oldprice != $price) || $oldstock != $qty1 ) {

          $product->setPrice($price);

          if ($oldstock != $qty1) {
            $product->setStockData(array(
                    'use_config_manage_stock' => 0,
                    'manage_stock' => 1,
                    'is_in_stock' => 1,
                    'qty' => $qty1 ));
        $product->setQuantityAndStockStatus(['qty' => $qty1, 'is_in_stock' => 1]);
          }else{
            //echo " \n oldStock & new stock are equal ".$qty;
         }
         $product->save();

        }else {
          //echo " \n oldprice & new price are equal ".$price;
        }
        unset($storeIds, $websiteObj, $_websiteId);
        unset($product);
        }

Please guide me. if there is no product available with SKU
what will be in

$prduct_id_sku = $product->load($product->getIdBySku($product_id));

$prduct_id_sku will be null or not. I was not able to debug to test this out.


texts: Plugin not working in live environment in Magento 2

texts:
I have overwritten the Tax class for IGST calculation customization. It's working fine on my local system. After I uploaded the live server it's not working, I don't know where anything I missed.

For this stuff, I have written below logic.

di.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
    <type name="Magento\Tax\Model\Sales\Pdf\Tax">
        <plugin name="OverWritePdfTax" type="ABCSolutions\IGST\Model\Sales\Pdf\Tax" />
    </type>
</config>

Tax.php

<?php

namespace ABCSolutions\IGST\Model\Sales\Pdf;

class Tax extends \Magento\Tax\Model\Sales\Pdf\Tax{

    public function aroundGetTotalsForDisplay(\Magento\Tax\Model\Sales\Pdf\Tax $tax, callable $proceed)
    {
        $totals = [];
        $totals = $proceed();

        $isValidAmount = false;
        $tempTotal =  array();
        $tempETotal = array();
        $tempI = 0;
        $totalCount = count($totals) - 1;
        $tempTaxAmount = 0;
        $tempAmount = 0;

        foreach($totals as $t){
            if($totalCount == $tempI){
                $tempTaxAmount = $t['amount']/2;
                $tempTaxAmount = number_format($tempTaxAmount,2,'.','');
                $tempAmount = number_format($t['amount'],2,'.','');
            }
            $tempI++;
        }

        foreach($totals as $t){
            if(($t['title'] == "SGST") || ($t['title'] == "CGST")){
                $SAmount = number_format($t['amount'],2,'.','');
                if($tempTaxAmount == $SAmount){
                    $isValidAmount = true;
                    break;
                }else{
                    $isValidAmount = false;
                    break;
                }
            }
        }

        if(!$isValidAmount){
            $tempETotal = $totals;
            //Change the totals according to IGST
            $tempTaxAmount = $tempAmount/2;
            foreach($tempETotal as $t){
                if(isset($t['title'])){
                    if(($t['title'] == "SGST") || ($t['title'] == "CGST")){

                        $tempTotal[] = array(
                            'amount' => number_format("$tempTaxAmount",2,'.',''),
                            'label' => $t['label'],
                            'font_size' => $t['font_size'],
                            'percent' => number_format($t['percent'],2,'.',''),
                            'title' => $t['title'],
                            'tax_amount' => number_format($tempTaxAmount,2,'.',''),
                            'base_tax_amount' => number_format($tempTaxAmount,2,'.','')
                        );
                    }
                }else{
                    if(isset($t['label'])){
                        if($t['label'] == "Tax:"){
                            $tempTotal[] = array(
                                'amount' => number_format($t['amount'],2,'.',''),
                                'label' => $t['label'],
                                'font_size' => $t['font_size']
                            );
                        }
                    }
                }
            }
           unset($totals);
           $totals = $tempTotal;
        }
        return $totals;
    }

}

Here $totals = $proceed(); it's returning the $total value i.e SGST,CGST and Tax in local system.

After successfully working I deployed the live server it's not working. When I debug the code $totals = $proceed(); returning empty Array().

I don't know why it's not working.

Any suggestion on this?


texts:
I don't know what 'as' really means in the context of layout XML files.

For instance, I could add in something like to some product page:

<block type="custom/whatever" name="custom.whatever.block" template="whatever.phtml" />

Or, I could blindly copy what generally happens and put this together:

<block type="custom/whatever" name="custom.whatever.block" as='supercalifragilisticexpialidocious' template="whatever.phtml" />

Then in my product page template I could do this:

<?php echo $this->getChildHtml('supercalifragilisticexpialidocious') ?>

Or I could do:

<?php echo $this->getChildHtml('custom.whatever.block') ?>

With a fair expectation that my custom/whatever block will render on the page using the whatever.phtml template regardless of whether I use the full name or the 'as' alias.

I am sure this question has been asked before, however, 'as' is one of those words that doesn't really suit Bing! or other search engines particularly well.


texts: Magento 2: Display out of stock items in the end in API

texts:
I am using a headless magento 2 approach for my store. I have made an API which accepts parameters like:

  category_slug, sort_by, sort_order, page_size, current_page

and returns the products matching the criteria.

Now the issue I am facing is, I want the out of stock products to be pushed down at the end of the ENTIRE collection.

My code is below:

$categoryProducts = $productFactory->create()
                        ->addAttributeToSelect('*')
                        ->addCategoriesFilter(array('in' => $categoryList))
                        ->addAttributeToFilter('status',1)
                        ->addAttributeToFilter('visibility',4)
                        ->addAttributeToSort($sort_by, $sort_order)
                        ->addAttributeToSort('is_in_stock', 'DESC')
                        ->setPageSize($page_size)
                        ->setCurPage($current_page)
                        ->load();

is_in_stock is a custom attribute I created which automatically gets set to 0 or 1 (0 being out of stock and 1 being in-stock), whenever a change in stock is detected (did this using an observer, working fine).

Now, suppose I want to sort the collection on PRICE, in ASC order the collection I am getting after this would look something like:

  In-stock items of 10$, Out of stock items of 10$, In-stock items of
  15$, Out of stock items of 15$, in stock items of 20$, and so on...

But what I want is:

  In-stock items of 10$, In-stock items of 15$, in stock items of 20$, Out of stock items of 10$, Out of stock items of 15$, and so on...

I feel it's something really small and stupid that I am missing. any help would be appreciated.

Thanks!


texts: Want to know how to override any file in magento2 like magento1 (Copy core file to local directory)

texts:
I try to override

  D:\XAMPP\htdocs\vinm2\vendor\magento\module-shipping\view\adminhtml\templates\view\form.phtml

So I copy it to

  D:\XAMPP\htdocs\vinm2\app\design\frontend\Vend\vision\Magento_Shipping\templates\view\form.phtml

I also tried

  D:\XAMPP\htdocs\vinm2\app\design\frontend\Vend\vision\Magento_Shipping\view\adminhtml\templates\view\form.phtml

but not working.

can any one let me know what is wrong here?

Updated:

As per suggestion here i create module..

D:\XAMPP\htdocs\vinm2\app\code\Bkjain\Shipp have below files & directory

1: etc
2: view
3: registration.php

etc have module.xml with below code.

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Bkjain_Shipp" setup_version="1.0.0">
    </module>
</config>

2: view have adminhtml--

                    -layout -> adminhtml_order_shipment_view.xml

                    -templates -> form.phtml

adminhtml_order_shipment_view.xml  have below code.

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance dc" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceBlock name="sales_shipment_view">
        <action method="setTemplate">
            <argument name="template" xsi:type="string">Bkjain_Shipp::form.phtml</argument>
        </action>
    </referenceBlock>

form.phtml have default code but it not display anything.. IF i delete content of that file & just write echo then it show echo value ..


texts: popup is not displayed in in magento2 admin grid

texts:
I'm a beginner on Magento and I'm stuck at the pop-up level, so I did the add action button and it works fine

  <actionsColumn name="actions" class="Managys\Pricing\Ui\Component\Listing\Column\ProductActions">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="resizeEnabled" xsi:type="boolean">false</item>
                <item name="resizeDefaultWidth" xsi:type="string">107</item>
                <item name="indexField" xsi:type="string">entity_id</item>
            </item>
        </argument>
    </actionsColumn>

but I have to change that part to open a pop -up to choose a category. I followed this tutorial but unfortunately the pop-up is not displayed:
enter link description here

<actionsColumn name="actions" class="Managys\Pricing\Ui\Component\Listing\Column\Sendmail">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="component" xsi:type="string">Managys_Pricing/js/grid/columns/sendmail</item>
                <item name="resizeEnabled" xsi:type="boolean">false</item>
                <item name="resizeDefaultWidth" xsi:type="string">107</item>
                <item name="indexField" xsi:type="string">entity_id</item>
                <item name="sortable" xsi:type="boolean">false</item>
                <item name="label" xsi:type="string" translate="true">Send Mail</item>
                <item name="sortOrder" xsi:type="number">13</item>
            </item>
        </argument>
    </actionsColumn>

is there another method?
and thank you in advance


texts: Get product attribute measurement in magento2

texts:
How to get the width of Product UoM in magento2

Ex: Weight : 100 cm

Thanks.


texts: I want to create a custom model that pulls data from an external system via web service calls

texts:
I want to be able to page through this data and I was wondering if Magento supports the ability to force a new call into the model whenever a user clicks on the next button, or the previous button.

E.g. instead of pulling in all of the data in one trip the web service call, I want to be able to request the appropriate data based on the current page, the current sort order, etc.

I would like to be able to do this with the standard products database table as well.

Can this be done?

One issue I see is first obtaining the total number of records available, so that the pager control knows how many page selector links to display.


texts: Magento 2.2 Order "Request does not match any route"

texts:
I've currently enabled purchase orders so that I can test offline payment methods (other primary method will be authorize.net direct post, but that's not currently enabled).

I've created 2 orders now, and every time I try to cancel or invoice either order I get an error on the page "Request does not match any route".  I don't seem to get any other error in the console.  I'm not seeing anything in any of the debug logs (and I'm in developer mode).  What can I do to debug this error to figure out why it's rejecting these changes?


texts: Magento-2.2.4 order confirmation mail not sent to logged user

texts: Order confirmation mail not sending only to logged in user. Guest user receiving order mail. Send mail function in order detail section from admin also not sending mail.


texts: How to save a image in my magento module

texts:
I had created a checkboxes like isLab and isFood.

When i check isLab the image is saving.But when i uncheck isLab checkbox the image is not saving.

Before adding these checkboxes there is no problem with image saving.After adding these checkboxes there is an issue with image saving

Can anybody help me how to save an image. I need it very soon.


texts: How to add custom attribute in Stock-Sku in product view

texts:
i need to add my custom attribute (free shipping, 24h, 48h...) in product view.

This block class is product-info-stock-sku.

Thanks,
Adrz


texts: Is there any limitations of number of products to import in magento?

texts:
I have imported around 60k(60,000 products) data in magento successfully, but now it doesn't respond anything. When I click on "check data" all the files get successfully loaded but neither its showing me any error nor it showing import button to import. file get loaded 100% and browser show that its waiting for server to respond and then it goes down or get stable without responding anything. this is happening for the second time at the same stage when near around 60,000 rows been inserted in database . till 60k I can import data smoothly but after that I don't know what's wrong is happening with it. I can guess something wrong is happening with database, Is there any limitations for database size or what ? please someone help me !

Here is the error which chrome network inspector shows me. I have go-daddy shared hosting server Name: ?form_key=YLBXpW6Kp2mQPJHP /index.php/admin/import/validate/key/32287e1110caa33de08937d94ed947b Status: 500 Internal Server Error


texts: Can I migrate from Magento 1.9 to 2.0 when my site crashed?

texts:
My site on Magento has crashed, then the next day my hosting company said that there was an error somewhere with coding so I'm thinking now is the time to move from Magento 1.9 to 2.0.
I set up the new VPS and installed the Magento 2.0. Is it possible to migrate my data (especially my products) to the new version of my site has crashed and I have no access to the Magento admin?


texts: Missing styles on Magento 2 checkout page

texts:
I made a custom child theme based on Luma theme. But on the checkout page it's missing some styling http://staging.netconnectshop.be/checkout/.

What do I have to do?

Do I have to copy the folder /vendor/magento/theme-frontend-luma/Magento_Checkout (see attachment) to my child-theme folder: /app/design/frontend/Meesfrenkelfrank/ncs-theme ?

Update 1:
Look at this screenshot where you can see the error. You have to scroll to the right. There are styles missing on e.g. <div class="opc-wrapper">


texts: How to call phtml file on every page in magento 1?

texts:
I am trying to call a phtml file on every page in magento 1 head section
is their any way we can perform it in magento 1 ?
I am using a theme.


texts: how to return the user to the previous page when a span is clicked

texts: When a user clicks a specific button i'd like it to return the user to the previous page visitied.  Is this possible?


texts: How to filter collection for json data field in magento2?

texts:
Have any function or way we can directly filter json data in magento2?

like:

brand: {"product":"test","purchase":"500"}

if i want to filter more than purchased 500 times in magento2 have any easy way?


texts:
In Magento products attributes are assigned in Groups under an attribute set. I am trying to create a new Attribute Group like General, Price.

I want assigned the new product attribute to that new attribute group not to the "General"

My finding till now is :

Attribute Groups are stored in eav_attribute_group table

How it can be achieved programmatically?
Any Help is appreciated.


texts:
I have found any issue in magento.cron.log

Warning: proc_open(): fork failed - Resource temporarily unavailable in /home/czasowe/domains/czasowewyprzedaze.pl/public_html/vendor/symfony/console/Application.php on line 959#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'proc_open(): fo...', '/home/czasowe/d...', 959, Array)
#1 /home/czasowe/domains/czasowewyprzedaze.pl/public_html/vendor/symfony/console/Application.php(959): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 /home/czasowe/domains/czasowewyprzedaze.pl/public_html/vendor/symfony/console/Application.php(761): Symfony\Component\Console\Application->getSttyColumns()
#3 /home/czasowe/domains/czasowewyprzedaze.pl/public_html/vendor/symfony/console/Application.php(722): Symfony\Component\Console\Application->getTerminalDimensions()
#4 /home/czasowe/domains/czasowewyprzedaze.pl/public_html/vendor/symfony/console/Application.php(656): Symfony\Component\Console\Application->getTerminalWidth()
#5 /home/czasowe/domains/czasowewyprzedaze.pl/public_html/vendor/symfony/console/Application.php(127): Symfony\Component\Console\Application->renderException(Object(Exception), Object(Symfony\Component\Console\Output\StreamOutput))
#6 /home/czasowe/domains/czasowewyprzedaze.pl/public_html/bin/magento(23): Symfony\Component\Console\Application->run()
#7 {main}

Warning: proc_open(): fork failed - Resource temporarily unavailable in /home/czasowe/domains/czasowewyprzedaze.pl/public_html/vendor/symfony/console/Application.php on line 959#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'proc_open(): fo...', '/home/czasowe/d...', 959, Array)
#1 /home/czasowe/domains/czasowewyprzedaze.pl/public_html/vendor/symfony/console/Application.php(959): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 /home/czasowe/domains/czasowewyprzedaze.pl/public_html/vendor/symfony/console/Application.php(761): Symfony\Component\Console\Application->getSttyColumns()
#3 /home/czasowe/domains/czasowewyprzedaze.pl/public_html/vendor/symfony/console/Application.php(722): Symfony\Component\Console\Application->getTerminalDimensions()
#4 /home/czasowe/domains/czasowewyprzedaze.pl/public_html/vendor/symfony/console/Application.php(656): Symfony\Component\Console\Application->getTerminalWidth()
#5 /home/czasowe/domains/czasowewyprzedaze.pl/public_html/vendor/symfony/console/Application.php(127): Symfony\Component\Console\Application->renderException(Object(Exception), Object(Symfony\Component\Console\Output\StreamOutput))
#6 /home/czasowe/domains/czasowewyprzedaze.pl/public_html/bin/magento(23): Symfony\Component\Console\Application->run()
#7 {main}

Does anyone know what a issue is and how can I solve it?


texts:
I want to remove country from Checkout payment block.

This was fill by knock js but i don't know how to remove this.


texts: Magento 2 checkout form: how to apply custom template for field?

texts:
Currently I can redefine ui/form/field (not input!) use my theme,

but I need to set custom template for each field. I try to use code from docs with small fix.

<item name="shippingAddress" xsi:type="array">
    <item name="children" xsi:type="array">
        <!-- The name of the form the field belongs to -->
        <item name="shipping-address-fieldset" xsi:type="array">
            <item name="children" xsi:type="array">
                <!-- the field you are customizing -->
                <item name="firstname" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <!-- Assigning a new template -->
                        <!--
                        <item name="elementTmpl" xsi:type="string">%Vendor_Module%/form/element/%your_template%</item>
                        -->
                        <item name="template" xsi:type="string">Vendor_Checkout/form/field</item>
                    </item>
                </item>
            </item>
        </item>
    </item>
</item>

Templates (2 for testing...):

/app/code/Vendor/Checkout/view/frontend/web/template/form/field.html;
/app/code/Vendor/Checkout/view/frontend/web/templates/form/field.html.

This is not working. Why?

UPD: Fixed path.