texts: Get product attribute in cart in Magento2

texts:
I'm trying to grab a product attribute in the cart template. But I just does not work! The attribute is set to Visible on Catalog Pages on Storefront = yes and Used in Product Listing = yes

I use a custom module to override the following template:

/vendor/magento/module-checkout/view/frontend/templates/cart/item/default.phtml

I have the product:

$_item = $block->getItem();
$product = $_item->getProduct();

Normally I would expect a custom attribute (of type text-area in this case) with an attribute code of 'sample_attr' to be available with one of these:

$product->getData('sample_attr');

or

$product->getSampleAttr();

Some attributes are available using this (sku, weight, price ..), but for a custom attribute neither works.
The included helper (\Magento\Msrp\Helper\Data) also has no attribute method.

I can get all attribute codes using:

   $attributes = $product->getAttributes();
   foreach($attributes as $a)
   {
     var_dump($a->getName());
   }

I've also tried:

    $attribute = $product->getResource()->getAttribute('sample_attr');
    var_dump($attribute->getFrontend()->getValue($product));

but this returns null.

So how do I get the value of the attribute?

I've tried these:
Get specific attribute for each product on catalog page

Output custom text attribute in catalog list.phtml (Magento 2)


texts:
Hello I would like to add a image to a phtml file. however it didn't get use to the magento code to get the image path

<img src="{{media url='/ca_flag.png'}}"/>

Somehow the image address was translate to something like this

www.domain.com/%7B%7Bmedia%20url='/ca_flag.png'%7D%7D

what should I use?

Thanks


texts: Ui form: Edit functionality: Image Preview in magento 2

texts:
I have created Ui form.
In that, I have uploaded a image which is also saved in DB and shows preview in admingrid.
It shows image preview for a new action But it is failed to show image preview and size in edit functionality . Please suggest me a solution

The below image for newaction and it works perfectly.

The below image for edit and not working.But if i click on image it shows preview in new page(http://localhost/magento220/pub/media/girl_2.jpg).

DataProvider.php

<?php

namespace namespace\HomeSlider\Model;

use namespace\HomeSlider\Model\ResourceModel\Post\CollectionFactory;
use Magento\Store\Model\StoreManagerInterface;

class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider
{

    protected $collection;
    protected $_loadedData;
    protected $_storeManager;

    public function __construct(
    $name, $primaryFieldName, $requestFieldName, CollectionFactory $postCollectionFactory, StoreManagerInterface $storeManager, array $meta = [], array $data = []
    )
    {
        $this->collection = $postCollectionFactory->create();
        $this->_storeManager = $storeManager;
        parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
    }

    public function getData()
    {

        if (isset($this->_loadedData)) {
            return $this->_loadedData;
        }
        $items = $this->collection->getItems();
        foreach ($items as $item) {
            $this->_loadedData[$item->getId()] = $item->getData();

            if ($item->getImage()) {

            $m['image'][0]['name'] = $item->getImage();
            $m['image'][0]['url'] = $this->getMediaUrl().$item->getImage();

            $fullData = $this->_loadedData;
            $this->_loadedData[$item->getId()] = array_merge($fullData[$item->getId()], $m);
            }

        }

        return $this->_loadedData;
    }

    public function getMediaUrl()
    {
        $mediaUrl = $this->_storeManager->getStore()
                        ->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);

        return $mediaUrl;
    }

}

Uiform.xml

 <field name="image" sortOrder="100" formElement="fileUploader">
            <settings>
                <notice translate="true">Allowed file types: jpeg, gif, png.</notice>
                <label translate="true">Image</label>
                <componentType>fileUploader</componentType>
            </settings>
            <formElements>
                <fileUploader>
                    <settings>
                        <allowedExtensions>jpg jpeg gif png</allowedExtensions>
                        <maxFileSize>2097152</maxFileSize>
                        <uploaderConfig>
                            <param xsi:type="string" name="url">homeslider/post/upload</param>
                        </uploaderConfig>

                    </settings>
                </fileUploader>
            </formElements>
        </field>


texts: Multiple Conditions in Table Rate Shipping (2.x)

texts:
I haven't set up any table rate shipping in Magento before so this may be a very simple question with an obvious answer. Is there a way baked into default Magento 2.x to specify shipping based on multiple conditions. For example:

All items under 300 lbs are $15 flat rate for all of those items but every item over 300 lbs is $55 for each item.

I know it's likely to require a custom shipping method but I'd rather not reinvent the wheel if I don't have to.


texts: Magento2 : Adding simple products to configurable product via admin

texts:
I just did a demo migration using cart2cart.

It created some configurable products as well as simple products that are supposed to be associated with them.

The simple products however are not associated in any way with the configurable products and I can't seem to find a way to do so.

This is magento 2.1.3. Am I missing something here?


texts: I am having trouble getting my credentials to work for the mage connect. I have read several articles that say to delete the cache.cfg and the connect.cfg which I don't seem to have those files. I also tried to upload a new downloader folder and that will not work either. Can someone point me in the right direction?


texts: Magento 2: How to get current Currency and symbol in PHTML File?

texts: How can I get current currency and currency symbol in Magento 2 in a template (.phtml file)? Without creating a block


texts: Magento 2 - product's url_key changed automatically

texts:
We are using Magento 2.2.5. Currently in Magento store we managing url key by concatenating product's name with the brand's name. So many times in some products url key of product's changed from only product's name. For example,

product's name is abc and brand name is xyz, then we generating url key as xyz-abc and importing these keys via product import. And after import it all looks fine and working well. But after some time it's get changed automatically from url_key xyz-abc to abc (So it's brand names removed for some products). and also we have done indexing, still don't know what is issue. Also there are no 3rd party extension that causing this kind of issue.

Dose anyone know something about this?

Thanks In Advanced.


texts:
Recently I took over the management of a Magento store. Yesterday we recieved an email from an IT company stating our store wasn't secure. Eventhough I doubt the legitimacy of the email, it did show the last order in the store, the amount of registered customers and the last added product.

Since I recently became admin, after the realisation, I don't exactly know what security measures has been taken. The following things I know for sure:

There's a custom path for the admin panel
The data is send over https
The admin password is a string of random lower or uppercase letters

If this mail is legit, how can I fix this problem?


texts:
I am adding a countdown timer to a single CMS page that is counting down to September 20th, 2015.

I put all the javascript functions in js/countdownClock.js

function getTimeRemaining(endtime){
  var t = Date.parse(endtime) - Date.parse(new Date());
  var seconds = Math.floor( (t/1000) % 60 );
  var minutes = Math.floor( (t/1000/60) % 60 );
  var hours = Math.floor( (t/(1000*60*60)) % 24 );
  var days = Math.floor( t/(1000*60*60*24) );
  return {
    'total': t,
    'days': days,
    'hours': hours,
    'minutes': minutes,
    'seconds': seconds
  };
}

function initializeClock(id, endtime){
  var clock = document.getElementById(id);
  var daysSpan = clock.querySelector('.days');
  var hoursSpan = clock.querySelector('.hours');
  var minutesSpan = clock.querySelector('.minutes');
  var secondsSpan = clock.querySelector('.seconds');

  function updateClock(){
    var t = getTimeRemaining(endtime);

    daysSpan.innerHTML = t.days;
    hoursSpan.innerHTML = ('0' + t.hours).slice(-2);
    minutesSpan.innerHTML = ('0' + t.minutes).slice(-2);
    secondsSpan.innerHTML = ('0' + t.seconds).slice(-2);

    if(t.total<=0){
      clearInterval(timeinterval);
    }
  }

  updateClock();
  var timeinterval = setInterval(updateClock,1000);
}

var deadline = 'September 20 2015 08:59:59 UTC+0800';
initializeClock('clockdiv', deadline);

Then I called the file in the CMS page under the Layout Update XML sections:

<reference name="head">
  <action method="addItem">
    <type>js</type>
  </action>
</reference>

In the Content section of the page I put in:

.

Days

.

Hours

.

Minutes

.

Seconds

When I load the page however, only the labels Days, Hours, Minutes, Seconds displays. The javascript is supposed to calculate the time remaining and output the information in the content of the page with the span tags.

Does anyone know where I'm going wrong? Is the page even calling the javascript correctly?


texts:
If user register with website and send to the coupon code  for that customer.
How to get the coupon code and sent to the customer?
Is it possible to generate coupon code automatically?


texts: How can we get "is CustomerLoggedin" & "Cart having some items" using core PHP not Magento

texts:
Is there any way to get "is CustomerLoggedin" & "Cart having some items" In core PHP file that i have created parallel to index.php file.

I think using some cookies we can get those values. But not sure how.

Anyone can help here


texts: Magento 2 Bundle\Custom Option New Field Not Show Value

texts:
What we have:

di.xml

<type name="Magento\Bundle\Ui\DataProvider\Product\Form\Modifier\BundlePanel">
    <plugin name="bundle_option_sku" type="SY\Configurator\Plugin\Catalog\Ui\DataProvider\Product\Form\Modifier\BundlePanel" sortOrder="1000"/>
</type>

UpgradeSchema.php

<?php
namespace SY\Configurator\Setup;

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

class UpgradeSchema implements UpgradeSchemaInterface {
    public function upgrade(
        SchemaSetupInterface $setup,
        ModuleContextInterface $context
    ){
        $installer = $setup;
        $installer->startSetup();
        if(version_compare($context->getVersion(), '0.0.3', '<')) {
            $installer->getConnection()->addColumn(
                $installer->getTable('catalog_product_bundle_option'),
                'option_sku',
                [
                    'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                    'length' => 255,
                    'nullable' => true,
                    'comment' => 'Sku'
                ]
            );
        }
        $installer->endSetup();
    }
}

Plugin:

class BundlePanel {
    public function afterModifyMeta(
        \Magento\Bundle\Ui\DataProvider\Product\Form\Modifier\BundlePanel $subject,
        $meta
    ){
        $meta['bundle-items']['children']['bundle_options']['children']['record']['children']['product_bundle_container']['children']['option_info']['children']['option_sku'] = $this->getSkuFieldConfig(
            11,
            [
                'arguments' => [
                    'data' => [
                        'config' => [
                            'label' => __('Sku'),
                            'component' => 'Magento_Catalog/component/static-type-input',
                            'valueUpdate' => 'input',
                            'imports' => [
                                'optionId' => '${ $.provider }:${ $.parentScope }.option_id'
                            ]
                        ]
                    ]
                ]
            ]
        );
        return $meta;
    }
    protected function getSkuFieldConfig($sortOrder, array $options = []){
        return array_replace_recursive(
            [
                'arguments' => [
                    'data' => [
                        'config' => [
                            'label' => __('Sku'),
                            'componentType' => \Magento\Ui\Component\Form\Field::NAME,
                            'formElement' => \Magento\Ui\Component\Form\Element\Input::NAME,
                            'dataScope' => 'option_sku',
                            // 'dataScope' => 'title',
                            'dataType' => \Magento\Ui\Component\Form\Element\DataType\Text::NAME,
                            'sortOrder' => $sortOrder,
                            'validation' => [
                                'required-entry' => true,
                                // 'no-whitespace' => true,
                                'validate-alphanum-with-spaces' => true
                            ]
                        ]
                    ]
                ]
            ],
            $options
        );
    }
}

All is ok, showing and saving, but saved values not appends, what is need to do?


texts: Magento 2: Change Upsell text: We found other products you might like!

texts:
For upsell products in Magento2, how can edit the text above the upsell products that says: "We found other products you might like!"

I would like it to say "Customers also viewed"


texts: When select a particular payment method how to add a custom block in order summary block in checkout page in magento 2

texts:
When selecting a particular payment method how to add a custom block in the order summary block in checkout page in Magento 2
I used this extension https://github.com/bragento/magento2-cash-on-delivery-fee
but I got an issue  404 issue /V1/guest-carts/xcx4SQDhPYJDycVn6lRjgsCuJOGBVswj/set-payment-information-and-get-totals


texts:
I am new to Magento and facing issue with Magento connect manager which is showing as disabled.
I am using free subdomain hosting and Magento

ver 1.9 is installed by hosting provider.
Please let me know how can I enable the same?

Thanks,


texts: Is php version 7.0.23 okay for Magento 2.1.7?

texts:
My PHP version 7.0.23, and my Magento version 2.1.7, actually i need to install theme only. after run setup wizard i am getting an error like,

May i know what is the error and how can i solve it?


texts: Manage products page is broken - even after restore

texts:
This is how the manage product page is broken.
All content on this page is shown in left sidebar even when I create new product.
I can't change products, I can't create them because I can't save any changes.

I'd wanted to restore 1 month old backup. I did complete restore, system files and database. All was working nicely. But then I restored whole database via phpmyadmin. The problem was back. I assume the issue is in the database.

Can I restore only "important" part of database - catalog, customers, orders..?

Does anybody know how to find what cause the problem? I started to be hopeless.

Thank you in advance.

EDIT: Not even magento 1.9.1.0 upgrade didn't help.


texts: I need to display a products attribute if the product price is equal to 0 on a category page on Magento, similar to this post but using price to then display an attribute: https://stackoverflow.com/questions/28489186/magento-if-attribute-value-is-x-or-y-then-show-custom-block


texts: Validating form elements built via ui-components

texts:
I'm trying to have a custom validation to one of my Magento 2 form fields that is generated via ui-components.
I know that I can make the value required by adding a validation item in the config.
Like this:

   <field name="title">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="dataType" xsi:type="string">text</item>
                <item name="label" xsi:type="string" translate="true">Some label here</item>
                <item name="formElement" xsi:type="string">input</item>
                <item name="source" xsi:type="string">whatever</item>
                <item name="sortOrder" xsi:type="number">999</item>
                <item name="dataScope" xsi:type="string">whatever</item>
                <item name="validation" xsi:type="array">
                    <item name="required-entry" xsi:type="boolean">true</item><!-- this validates it as required -->
                </item>
            </item>
        </argument>
    </field>

What do I need to add inside the validation item and where do I place the js code that should validate my field based on custom conditions?
For example I want it to match a certain regex.


texts:
I am working with an observer where i have to disable a payment method if user has no order existed and show it if at least one order existed.
I am trying something like this but not able to get the order collection for current logged in user, i have tried printing in logger but getting Epmty Array there.
<?php

namespace Apriljune\Payments\Observer;

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Customer\Model\Session;

class PaymentMethodAvailable implements ObserverInterface
 {
 /**
 * @var Session
 */
private $session;

protected $logger;

/**
 * RemoveGuestViewPageBlocks constructor.
 *
 * @param \Magento\Customer\Model\Session $session
 */
public function __construct(
    Session $session,
    \Psr\Log\LoggerInterface $logger
){
    $this->session = $session;
     $this->logger = $logger;
}

public function execute(\Magento\Framework\Event\Observer $observer)
{

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();

    $orderCollection = $objectManager->get('Magento\Sales\Model\ResourceModel\Order\CollectionFactory');

    $customerId = $this->session->getCustomer()->getId();

    $order_collection = $orderCollection->create()->addAttributeToFilter('customer_id', $customerId );

    $itemCount = $order_collection->getSize();

    $this->logger->log(100, json_encode($order_collection));

    $this->logger->info("CustomerId=>".$customerId."<");

    if( $observer->getEvent()->getMethodInstance()->getCode() =="cashondelivery" ) {
        $checkResult = $observer->getEvent()->getResult();
        if( $itemCount < 1 ) {
            $checkResult->setData('is_available', false);
        }
    }
  }
}

can Anyone Identify what wrong i am doing ,
I have also tried in this way as well but still not working:
<?php

 namespace Apriljune\Payments\Observer;

 use Magento\Framework\Event\Observer;
 use Magento\Framework\Event\ObserverInterface;
 use Magento\Customer\Model\Session;

 class PaymentMethodAvailable implements ObserverInterface
 {
 /**
 * @var Session
 */
private $session;

protected $logger;

protected $_orderCollectionFactory;

/**
 * RemoveGuestViewPageBlocks constructor.
 *
 * @param \Magento\Customer\Model\Session $session
 */
public function __construct(
    Session $session,
    \Psr\Log\LoggerInterface $logger,
    \Magento\Framework\App\Action\Context $context,
    \Magento\Sales\Model\ResourceModel\Order\CollectionFactory $orderCollectionFactory
){
    $this->session = $session;
    $this->logger = $logger;
    $this->_orderCollectionFactory = $orderCollectionFactory;
    parent::__construct($context);
}

public function execute(\Magento\Framework\Event\Observer $observer)
{
     $customerId = $this->session->getCustomer()->getId();
     $collection = $this->orderCollectionFactory()->create($customerId)
     ->addFieldToSelect('*')
     ->addFieldToFilter('status',
            ['in' => $this->_orderConfig->getVisibleOnFrontStatuses()]
        )
     ->setOrder(
            'created_at',
            'desc'
        );

    $itemCount = $collection->getSize();

    $this->logger->log(100, json_encode($collection ));

    $this->logger->info("CustomerId=>".$customerId."<");

    if( $observer->getEvent()->getMethodInstance()->getCode() =="cashondelivery" ) {
        $checkResult = $observer->getEvent()->getResult();
        if( $itemCount < 1 ) {
            $checkResult->setData('is_available', false);
        }
      }
    }
 }

Also not working with this approach.
Any Help regarding this will be appreciated.
Thanks!


texts: how to get $_productCollection in phtml file magento 2

texts:
I am new to Magneto, I want to create HoverSlider on product list page. I want to override list.phtml file in my module. I am getting error in accessing methods of Magento\Catalog\Block\Product\ListProduct.

Catalog_category_view.xml

<head>
    <link src="Ktpl_HoverSlider::js/hoverslider.js"/>
    <link src="Ktpl_HoverSlider::css/hoverslider.css"/>
</head>
<body>
    <referenceContainer name="content">
        <block class="Magento\Framework\View\Element\Template" template="Ktpl_HoverSlider::product/list.phtml" />
    </referenceContainer>
</body>

list.phtml

$_productCollection = $block->getLoadedProductCollection();

$_helper = $this->helper('Magento\Catalog\Helper\Output');


texts: Pass array in {{block type="core/template" template="test/add.phtml" items='.$data.'}}

texts:
I dynamically create a cms page or I give the content the path of the block.

$data is an array form.

/**
 * @access public
 * @return void
*/
public function createCmsPageForStore($data){

    $urlCleanStore = $this->remove_accents($data['store_name']);

    if(in_array($urlCleanStore, $this->getCmsPageUrlKey())){

         Mage::getModel('cms/page')->load($urlCleanStore)->setContent('{{block type="core/template" template="boutique/boutique.phtml" items='.$data.'}}')->save();

    }
 }

I can not access my data, I don't understand how I can pass an array into a template.

Example: if I pass just one variable, it's working in my template


texts: Error on customer confirmation email in Magento 2

texts:
I get receive the confirmation email in inbox as a customer.When i click on link confirm your account it throws error "There was an error confirming the account
" on website.How to fix it.


texts: How do I get simple product not associate with any configurable product?

texts: How do I get all simple product not associate with any configurable , bundle , group product in Magento API 2 ?


texts: Magento 2.3. How to add data using model?

texts:
I have two variants adding data using Model. Which variant is more rignt ?

Especially I want to ask about this
 $slider->setDataChanges(true);in first variant because I must set up _hasDataChanges = true if I want to save data.

1.Variant

2.Variant


texts: Magento: How to get Order shipping address line 2

texts:
I need to get a second line of Magento order shipping address, currently I am getting information like so:

        $this->formatText($order->getBillingAddress()->getData('prefix')),
        $this->formatText($order->getBillingAddress()->getData('firstname')),
        $this->formatText($order->getBillingAddress()->getData('middlename')),
        $this->formatText($order->getBillingAddress()->getData('lastname')),
        $this->formatText($order->getBillingAddress()->getData('suffix')),
        $this->formatText($order->getBillingAddress()->getData('street')),
        $this->formatText($order->getBillingAddress()->getData('city')),
        $this->formatText($order->getBillingAddress()->getData('region')),
        $this->formatText($order->getBillingAddress()->getData('country_id')),

All is good, however when customer supplies address line 2, see image below:

My code does not capture that line, anyone knows how to get address line 2 in Magento?


texts: How to get orders collection in magento 2

texts:
Magento 2 get order collection to update customers id using csv.

For example we can take magento 1 we can update using test.php file like that how we can update in magento 2.

I am creating new module I am planing to update using controller.But in that how can i get orders collection can any one help me....


texts: Credit Card Type N/A in magento admin sales->order

texts:
Credit card type is, of course, required field on the front end and the customer can't checkout with selecting one of options.

So how could the database get a NULL value in cc_type for an order? If anyone can explain what files are associated with receiving an order and inserting it into the database, that might help me figure out what's going on. The perplexing part is, this doesn't happen for every order, just a few over the course of a day.

Thanks!


texts: Get list of simple products which don't belong to a configurable

texts:
What is the best way to get a list of simple products which don't belong to a configurable?

I have a shop with mostly simple products which belong to a parent/configurable product. But some of the products (eg. jewellery) don't have options so they've been set up as lone simple products.

Ps this is for my own usage only so any solution that provides the right results will do :) thanks


texts: How to repair modules broken after applying patch SUPEE 6788 in magento 1.9.2.1

texts:
I have applied latest patch SUPEE 6788 in my magento 1.9.2.1 and found many modules broke.
Is there anyone who done the same and have recovered their broken modules..
Can anyone list detailed steps to follow so as to get thinks working?


texts:
I have a requirement from a client to integrate with their customer/warranty database using a REST Api. The client sells mobile phones and needs to manage warranties through this system.

However the software company providing the API is insisting that we should not use Magento's customer account system in favour of using theirs via an API. Basically removing all functionality relating to customer accounts in Magento and fetching all data with REST API Requests.

My preferred solution is to only query their API when required and sync data between like a usual CRM integration.

Please could I have some opinions as to if this is a good/bad idea? and why?
What is best practise and reasons why I can push back basically.


texts: Product has image but it show placeholder image as default image

texts:
I got a strange problem I imported products by csv. There're some products showing placeholder magento image, even it has image.

I try to re save, reindex, clear cache. not working it still showing. here's my website:

https://www.dcctoyou.com/index.php/--12997.html

I notice that all product showing placeholder image it can't set status disableand. I mean, it alway show on front even status is disabled.

Only one thing I can do if I want this product to hide on front. I need to uncheck main website store view, then i disappear.

Anyone has experience on this problem ?
Thanks


texts: How can I add dependencies when I rewrite a module in Magento 2?

texts:
I am trying to rewrite the \Magento\Catalog\Model\Layer\Filter\Item class in Magento by adding the following line to my di.xml:

<preference for="Magento\Catalog\Model\Layer\Filter\Item"
            type="Vendor\Module\Rewrite\Magento\Catalog\Model\Layer\Filter\Item"/>

Magento takes my Vendor\Module-class over it's default class, but I need to add some dependencies to it. Now I tried to add them by adjusting the __construct()-method and adding them there, but this doesn't work (which makes sence of course, because it breaks the chain for classes that try to extend the Item-object itself:

public function __construct(
    \Vendor\Module\Helper\Data $dataHelper,
    \Magento\Framework\UrlInterface $url,
    \Magento\Theme\Block\Html\Pager $htmlPagerBlock,
    array $data
) {
    $this->dataHelper = $dataHelper;
    parent::__construct($url, $htmlPagerBlock, $data);
}

The error I get is the following:

Missing required argument $data of Vendor\Module\Rewrite\Magento\Catalog\Model\Layer\Filter\Item.

So what's the proper way to get my helper in my rewritten object?


texts: In which referenceContainer of product page we add block for custom rich snippets of current product?

texts:
I have to extend default rich snippets for products. For this I have my script in .phtml file as:

<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
<?php if ($block->nameEnabled()) { ?>
"name": "<?php echo $_products->getName(); ?>",
<?php } ?> <?php if ($block->imageEnabled()>0) { ?>
"image": [
<?php if($block->imageEnabled()==1) { ?>
"<?php echo $imageurl['0'] ?>"
<?php } ?>
<?php if ($block->imageEnabled()==2) { ?>
"<?php echo $imageurl['1'] ?>"
<?php } ?>
<?php if ($block->imageEnabled()==3){ ?>
"<?php echo $imageurl['2'] ?>"
<?php } ?>
], <?php } ?>
<?php if ($block->desEnabled()==1) { ?>
"description": "<?php echo $_products->getShortDescription(); ?>",
<?php } ?>
<?php if ($block->desEnabled()==2) { ?>
"description": "<?php echo $_products->getMetaDescription(); ?>",
<?php } ?>
<?php if ($block->getBrand()) { ?>
"brand": {
        "@type": "Thing",
        "name": "<?php echo $brandName = $block->getBrand();?>"
    }, <?php } ?>
    <?php if ($block->skuEnabled()) { ?>
"sku": "<?php echo $_products->getSku(); ?>" ,<?php } ?>

"offers": {
<?php if ($block->priceEnabled()) { ?>
"@type": "Offer",
<?php if ($block->currencyEnabled()) { ?>
"priceCurrency": "<?php echo $block->getCurrencyCode(); ?>",<?php } ?>
"price": "<?php echo $_products->getFinalPrice(); ?>"
<?php } ?>
}
}
</script>

In which referenceContainer this block should be added so that snippets can be seen in https://search.google.com/structured-data/testing-tool/


texts:
I'm trying to assist my developer team.

I'm the client :-)

We're trying to replicate this (non-Magento site) pricing display.

https://www.broadcastwarehouse.com/aea-technology/140-525-antenna-analyzer-/349/product

and now on my Magento CE 1.9 site default product (ticked) and optional product below.

http://www.transmittersrus.com/aea-140-525-analyzer-5006-5001/

Both prices are added into Custom Options field in admin.
As one has to have something in the pricing field under simple product I have 0.00. Any other price and it just adds to whatever you have in Custom Options. This is driving us crazy.

Have a play with the BW products and see how the main price box changes and would really like to know if this can in some way be replicated in Magento. I don't mind a third party plug-in but would prefer to try and stay within 1.9 if at all possible.

Any help would be very much appreciated.

David


texts: 'only x left threshold' option not working

texts:
I have set the threshold to 7, I've set a simple product to quantity 2 and manage stock etc is on, it's also in stock. The setting 'Display products availability in stock in the frontend' is set to yes, they're all set correctly on store view/website level etc.

Yet it doesn't display the message, it doesn't even seem to be pulling in the template file that the message is in (cataloginventory/stockqty/default.phtml) although I don't even know how it would pull in this file as it exists in cataloginventory not catalog, also I can't find any reference to it in catalog.xml


texts: exclude filter condition in layered navigation

texts:
I want to hide products with certain attribute values. If I simply filter the collection in catalog, then faceted data for the filters will not match resulting products.
Igor Minyaylo said that recommended extension point is the addFieldToFilter method in fulltext collection. Though, I can't specify the condition type and therefore use the "not in" or rather "not match" filter.
Fulltext search might lose it's speed with such conditions, so I'm curious what's the recommended way to exclude some products.
P.S. I'd like to avoid changing filter type in the layered navigation.


texts: Can someone explain the app/etc/local.xml file?

texts:
In creating a new currency import option, I inadvertently replaced the local.xml file on my dev site with the one on my live site, causing the dev site to redirect to the live site.  I think I have fixed this but would like a further explanation as to what this file actually does and what I may have changed by copying the live file onto the dev site (I fixed it by changing the database login information, but it would be nice to know if there was anything I had missed).

Can anyone help?


texts: How to configure varnish with mod_pagespeed for magento

texts:
I installed mod_pagespeed on my dedicated server.
but when i configure varnish on this server i got error max age should to be 1.
I need to know that can we use both varnsih and mod_pagespeed on same url.
Like can it both work well if both are working on server.


texts: i was searching through a template store and they have magento templates for version 1.7 however im using 1.9.2.x. Will the template need to be recoded or just needs to be put into the right directory in verion 1.9.2.x.


texts: Filter a count column in a custom admin grid

texts:
I have an admin grid with a count column, everything works fine except the filtering.

This is my _prepareCollection() method :

protected function _prepareCollection()
{
    $orders              = Mage::getModel('Sales/Order')
                                ->getCollection()
                                ->addFieldToFilter('main_table.status', array('eq' => 'complete'));

    $orders->getSelect()
        ->joinLeft(
            array(
                'sorders' => 'suiviprepa_suiviorders'),
                'main_table.increment_id = sorders.order_increment_id ',
                array(
                    'num_issues' => 'COUNT(sorders.reason)'
                )
            )
        ->group('main_table.increment_id');

    $this->setCollection($orders);

    return parent::_prepareCollection();
}

In _prepareColumns() I added a filter callback:

$this->addColumn('prepa_order_issues',
    array(
        'header'                        => 'Problems',
        'index'                         => 'num_issues',
        'type'                          => 'number',
        'renderer'                      => 'Name_Mymodule_Block_Adminhtml_Orders_Renderer_Numissues',
        'filter_condition_callback'     => array($this, '_prepaIssuesFilter')
    )
);

Like this:

protected function _prepaIssuesFilter($collection, $column)
{
    (int) $filterValue = $column->getFilter()->getValue();

    if (!is_null($filterValue)) {
        $collection->getSelect()->having('COUNT(sorders.reason) = ?', $filterValue);
    }
}

The final request is working (if I run it in MySQL is does the job), but Magento returns an error, I guess running another simple request for pagination purpose :

  SQLSTATE[42S22]: Column not found: 1054 Unknown column
  'sorders.reason' in 'having clause', query was: SELECT COUNT(*) FROM
  `sales_flat_order` AS `main_table` WHERE (main_table.status =
  'complete') HAVING (COUNT(sorders.reason) = 1)

Does anyone has any idea how to make such a filtering on count column work?


texts: Overriding private method of Model file in Magento 2

texts:
I am overriding private method of model file of checkout module

below is my di.xml file.

<preference for="Magento\Checkout\Model\DefaultConfigProvider" type="Vendor\Module\Model\DefaultConfigProvider" />

An here is my model file.

 use Magento\Customer\Api\CustomerRepositoryInterface;
 class DefaultConfigProvider extends
 \Magento\Checkout\Model\DefaultConfigProvider
{
  protected $customerRepository;
  public function __construct(
   CustomerRepositoryInterface $customerRepository
   ) {
     $this->customerRepository = $customerRepository;
}
 private function getCustomerData()
  {
    $customerData = [];
    if ($this->isCustomerLoggedIn()) {
        $customer = $this->customerRepository->getById($this->customerSession->getCustomerId());
        $customerMasterId = $customer->getMasterId();
        $masterCustomer = $this->customerRepository->getById($customerMasterId);
        $customerData = $customer->__toArray();
        foreach ($masterCustomer->getAddresses() as $key => $address) {
            $customerData['addresses'][$key]['inline'] = $this->getCustomerAddressInline($address);
        }
     }
     return $customerData;
  }

}

I am not able to override this function since it is private, I did research an found that we need to use plugin method for it, but not found which plugin and how to use in this scenario.

All i am looking is master customer have address so i need to read address from master customer instead of logged customer.

Please anyone suggest me how can i override that method to add my custom logic inside. Thanks in Advance.


texts: can anyone tell me from where this block is coming in magento 2

texts:
I am trying to find the block of which the referred section in the image is loading. Please help.

https://i.stack.imgur.com/BwTJb.png


texts: How can I get the solutions for these I am able to display custom link in left side dashboard but unable to make it has clicked in magento 2, as not clicked when clicking on my link.


texts: Hide blocks on cart page if the cart is empty

texts:
In checkout.xml I see

<action method="setCartTemplate"><value>checkout/cart.phtml</value></action>
<action method="setEmptyTemplate"><value>checkout/cart/noItems.phtml</value></action>
<action method="chooseTemplate"/>

I am trying to have a block only show up when there are items in the cart but not when its empty. How do I accomplish this?


texts: How to set the default layout for the custom module?

texts:
I am working on my first module and I stuck with frontend layout.

I created a block which I want to display in the right column.

In my layout.xml when I put my code in the default tag it is showing in my whole website, so i tried using this code blog_default tag but it is not showing anything.
How can I display my block in the right column.

Here is my layout.xml file

<?xml version="1.0"?>
<layout version="0.1.0">
<default>
 <reference name="root">
  <action method="setTemplate"><template>page/3columns.phtml</template></action>
</reference>
</default>
<blog_default>
  <reference name="right">
   <block type="blog/category_list" before="-" name="blog.category.list">
    <action method="setShowPopulatedOnly" ><show>1</show></action>
   </block>
   <block type="blog/widget_post_list" after="blog.category.list" name="blog.latest.posts"/>
 </reference>
</blog_default>
<blog_index_index>
 <reference name="content">
  <block type="blog/article_index" name="blog_index" template="blog/article/index.phtml"/>
</reference>
</blog_index_index>
</layout>

by this the right column is not showing my block. How can I display my block.


texts: Not able to change the text in french language translation in Magento2?

texts:
I installed a language pack of French of mageplaza it is successfully installed using composer and on my website language switcher is working fine but the issue is when i am changing the text that was still remaining to translate into french so i created fr_FR.csv into

  app/design/frontend/Theme/demo/i18n

for testing it is working or not i tried to change 'Add to Cart' that is already translated to 'Ajouter au panier' so i changed it to csv to 'Ajouter au panier test' but not changing.

I did cache flush and deploy content too.


texts: Magento 2 command line for php bin/magento setup:upgrade

texts:
I have an issue to install Magento theme extension using -jailshell-4.2$

I used to be use command line php bin/magento setup:upgrade

And now the "TERMINAL" on my mac doesn't work properly as before.

Does anyone know what command line should I typing?

Thank you


texts: (Solved) Magento 2, Add product image in all transaction emails(shipment, invoice, credit memo)

texts:
I have managed to add products images in new order email using this solution:
Magento 2 product image in new order email

Unfortunately this piece of code is not working for other transactional emails:

credit memo
new invoice
new shipment

New Shipment email that i have received is showing error:

  " Error filtering template: Notice: Undefined variable: _order in
  /var/www/html/app/design/frontend/Packers/luma/Magento_Sales/templates/email/items/shipment/default.phtml
  on line 12 "

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

/** @var $_item \Magento\Sales\Model\Order\Item */
$_item = $block->getItem();

$_order = $_item->getOrder();   //   -->  line 12
$_store = $_order->getStore();

/* product images */
$_imageHelper = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Catalog\Helper\Image');
$_baseImageUrl = $_store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA).'catalog/product';

?>

         <img src="<?= $_imageHelper->init($_item->getProduct(), 'small_image', ['type'=>'small_image'])->keepAspectRatio(true)->resize('150','150')->getUrl();?>" alt="<?= __('Product Image');?>">

Is there any solution for getting product images displayed on all transactional emails?

WORKING SOLUTION (for all transactional emails):

<?php

$_item = $block->getItem()

$productId = $_item->getProductId();
$objectManagerHere = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManagerHere->get('Magento\Catalog\Model\Product')->load($productId);
$productImage = $this->helper('Magento\Catalog\Helper\Image')->init($product, 'category_page_list', array('height' => '100' , 'width'=> '100'))->getUrl();
?>

<img height="100" width="100" src="<?= $productImage ?>" alt="<?= __('Product Image');?>">


texts: Photo upload field on Account Information page

texts:
What would be the best and approach of adding photo upload field on customer's Account Information page?

I tried to use events 'customer_save_before' and 'customer_save_after' but they didn't fire at the right time and the temporary file was already gone.

I tried to override AccountController.php which processes form data but for some reason my override code in custom module doesn't work.

Is there any other relatively simple way to achieve this without overriding core files?


texts: Inconsistent product attribute index: Duplicate entries in catalog_product_index_eav


texts: Admin button "send shipment notification" not responding

texts:
In admin panel, in shipment detail view, the button "send shipment notification" has no effect. (no error, no log, no action at all).

In the page html it is defined as:

<button style="" onclick="deleteConfirm('Voulez-vous vraiment envoyer l'e-mail d'expédition au client ?', 'http://www.mysite.fr/index.php/admin/sales_order_shipment/email/shipment_id/1/key/942e4be724b96b93bfd660ef3ded72bd/')" class="scalable save" type="button" title="Envoyer une information de suivi" id="id_61c746468dcf6ec337ab6f70d3e0640d">Envoyer une information de suivi</button>

the deleteConfirm function called by the buttons apparently defined in js/mage/adminhtml/tools.js  but seems not to be run. (i tried adding in it alert("toto") but nothing happens…)

Thank you for your help,


texts:
When I try to create a user, I get this error:

"Rolled back transaction has not been completed correctly."

In system log I get:
 main.INFO: Broken reference: the 'notification.messages' tries to reorder itself towards 'user', but their parents are different: 'header.inner.right' and 'header' respectively.

Any idea?


texts: How to add position to products in product listing comes from search results in magento 1?

texts:
I am trying to add a position attribute in product object in
product listing which comes from search results.

Anybody have any idea how do achieve this ?


texts:
I'm trying to set an observer that fires on customer login and it doesn't appear to be set in magento (and therefore doesn't fire). I've debugged core files and the dispatchEvent function is being fired correctly, but my observer doesn't appear to exist in the registered events.

My code is as follows:

Foo\Bar\etc\config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Foo_Bar>
            <version>0.0.1</version>
        </Foo_Bar>
    </modules>
    <global>
        <models>
            <foo_bar>
                <class>Foo_Bar_Model</class>
            </foo_bar>
        </models>

... ... ...

        <events>
            <!-- fire on login -->
            <customer_login>
                <observers>
                    <foo_bar>
                        <class>foo_bar/observer</class>
                        <method>customerLogin</method>
                        <type>singleton</type>
                    </foo_bar>
                </observers>
            </customer_login>

... ... ...

        </events>
    </global>
</config>

Foo\Bar\Model\Observer.php

<?php
class Foo_Bar_Model_Observer extends Mage_Core_Model_Abstract
{
    public function customerLogin(Varien_Event_Observer $observer)
    {
        die('test'); // Doesn't do anything
    }

... ... ...

}

As I said before, I have about 6 other observers with basically identical configurations and methods that all work fine.

Can anyone help me out in pointing me to where I've gone wrong? Does the customer_login observer require some extra code to work correctly?

Thanks in advance!


texts: New attribute where you can select products

texts:
In default magento there are 3 sections where you can select associated products: related, upsells and crossells.

I need a forth one.

How can you create such an attribute where you would be able to associate products?

Is there a simple admin way or a custom module is involved?

Thanks!


texts: How do I get an access token with OAuth?

texts:
I'm trying to access my Magento store's REST API, but I can' seem to acquire the access token. I keep getting a 400 Bad Request (OAuth::Unauthorized) error.

Here's the code I'm using:

require 'oauth'
require 'mechanize'

@m = Mechanize.new

@title = @m.get('http://178.62.173.99/').title

@callback_url = 'http://178.62.173.99/'
@consumer = OAuth::Consumer.new(
  'b3ba0db944d1ad0d416329844734db54',
  '38fedbc5cdeed7803547b24a0980c834',
  :request_token_path => '/oauth/initiate',
  :authorize_path=>'/admin/oauth_authorize',
  :access_token_path=>'/oauth/token',
  :site => 'http://178.62.173.99'
)

@session = {}

@request_token = @consumer.get_request_token(:oauth_callback => @callback_url)
@session[:request_token] = @request_token
@session[:authorize_url] = @request_token.authorize_url(:oauth_callback => @callback_url)

@m.get(@session[:authorize_url]) do |login_page|
  auth_page = login_page.form_with(:action => 'http://178.62.173.99/index.php/admin/oauth_authorize/index/') do |form|
    form.elements[1].value = 'admin'
    form.elements[2].value  = 'goodfood88'
  end.submit

  authorize_form = auth_page.forms[0]

  callback_page = authorize_form.submit

  puts 'Successfully authorized application' unless callback_page.title != @title
end

@access_token = @request_token.get_access_token

It returns the following:

    Successfully authorized application
/Users/narzero/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/oauth-0.4.7/lib/oauth/consumer.rb:216:in `token_request': 400 Bad Request (OAuth::Unauthorized)
        from /Users/narzero/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/oauth-0.4.7/lib/oauth/tokens/request_token.rb:18:in `get_access_token'
        from six.rb:37:in `<main>'

I've stored the important data into a Hash, here's what it returns:

@session
# => {:request_token=>
  #<OAuth::RequestToken:0x007fe923161c00
   @consumer=
    #<OAuth::Consumer:0x007fe924083350
     @http=#<Net::HTTP 178.62.173.99:80 open=false>,
     @http_method=:post,
     @key="b3ba0db944d1ad0d416329844734db54",
     @options=
      {:signature_method=>"HMAC-SHA1",
       :request_token_path=>"/oauth/initiate",
       :authorize_path=>"/admin/oauth_authorize",
       :access_token_path=>"/oauth/token",
       :proxy=>nil,
       :scheme=>:header,
       :http_method=>:post,
       :oauth_version=>"1.0",
       :site=>"http://178.62.173.99"},
     @secret="38fedbc5cdeed7803547b24a0980c834">,
   @params=
    {:oauth_token=>"1bae7ce87f68d2090f131e7f3b98b26c",
     "oauth_token"=>"1bae7ce87f68d2090f131e7f3b98b26c",
     :oauth_token_secret=>"78921fcd23f6fa41356d56afadd8b1af",
     "oauth_token_secret"=>"78921fcd23f6fa41356d56afadd8b1af",
     :oauth_callback_confirmed=>"true",
     "oauth_callback_confirmed"=>"true"},
   @secret="78921fcd23f6fa41356d56afadd8b1af",
   @token="1bae7ce87f68d2090f131e7f3b98b26c">,
 :authorize_url=>
  "http://178.62.173.99/admin/oauth_authorize?oauth_callback=http%3A%2F%2F178.62.173.99%2F&oauth_token=1bae7ce87f68d2090f131e7f3b98b26c"}

What could I try to get an access token?


texts: how to upload video file WYSIWYG editor in Magento 2?

texts:
I can't upload a video file through WYSIWYG editor. Sometimes it says File validation failed.. Sometimes it simply doesn't do anything while uploading a file.

Kindly help me.


texts: How to call block without controller in phtml?

texts: How to call block without controller in phtml file for my custom module in magento2??


texts:
I am trying to put Cash on delivery as a payment method at checkout. No success so far. At payment step I get a "No payment method" message.
Things I did: cleared the cache, recompiled, installed different payment modules (magento-sample, Inchoo, Braintree), and then removed them. Also I tried different combinations of settings in admin pannel (merchant country, shipping methods). I disabled all payment methods, then enabled one at a time. The browser cache is empty.
In my final struggle I went full debugging and checked the messages between the server and the client. With wireshark I discovered that the message is received from server: {"payment_methods":[{"code":"cashondelivery","title":"Cash On Delivery"}],"totals":{details_about_products_in cart}. Then I went on jquery debug. In the picture, the data, received from server, is saved and is the same as the json above. After this function, the page gets a total refresh and the message "No payment methods is shown". Enable Onepage Checkout is enabled and desired.

How do I show Cash on delivery payment method in checkout?


texts: Can not called my CreateController while edit an order from backend

texts:
I want to change in SaveAction() of  Mage_Adminhtml_Sales_Order_CreateController. So for this I have make changes in config.xml like below :

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <Mycompany_Modulename before="Mage_Adminhtml">
                        Mycompany_Modulename_Adminhtml
                    </Mycompany_Modulename>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

and add file at

require_once Mage::getModuleDir('controllers', 'Mage_Adminhtml').DS.'Sales/Order/CreateController.php';

class Mycompany_Modulename_Adminhtml_Sales_Order_CreateController extends Mage_Adminhtml_Sales_Order_CreateController
{
}

It is working and called SaveAction() when admin create an order.But if admin edit an order that time SaveAction() is called from core file Mage_Adminhtml_Sales_Order_CreateController

Can anyone help on this ?


texts: Magento product collection override sort order with own order

texts:
I'm using Magento 1 and inside catalog/product/list.phtml I use the following code to add a custom sort order product_on_top:

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

$_productCollection->clear()
                    ->getSelect()
                    ->joinLeft(array('cpei'=>'catalog_product_entity_int'), 'e.entity_id = cpei.entity_id AND cpei.attribute_id = 197 AND cpei.store_id = 0', 'cpei.value as product_on_top' )
                    ->order( array( 'product_on_top DESC' ) );

By default Magento adds the price_index.min_price asc and final_price asc to the sort order and my product_on_top desc is added add the end of the order sort.

I would like to know if it is possible to make my custom product_on_top attribute the first attribute to sort on and not the price fields ?


texts:
How to override the category controller in Magento 2.3?

Please give me any solution?


texts: Get Products from attributes label or value(drop down)

texts:
I am geting all dropdown attributes value and name using below code

    $product = Mage::getModel('catalog/product');

 $attributes = Mage::getResourceModel('eav/entity_attribute_collection')
     ->setEntityTypeFilter($product->getResource()->getTypeId())
     ->addFieldToFilter('attribute_code', 'manufacturer');

 $attribute = $attributes->getFirstItem()->setEntity($product->getResource());

 $manufacturers = $attribute->getSource()->getAllOptions(false);

 foreach ($manufacturers as $manufacturer){

     echo $manufacturer_name = $manufacturer['label'];
    echo $manufacturer_value = $manufacturer['value'];

 }

i am also now how to get product from attributes for this i code this

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

$collection->addAttributeToSelect('manufacturer');

foreach($collection as $product){
    echo "<pre>";
 print_r($product->getData());
}

But My question is that I am create brand slider using manufacturer attributes (dropdown)
and i am set image from using manufacturer label.

But i want to create when click on manufacturer label(xyz) this it will display all product where set (xyz) in product list.


texts:
I am having issues with AOE Scheduler on Magento 1.9.1.1. After scheduling tasks through the extension, it does not seem to executive them at all. However if I directly run the task using "Run Now", it will work. It confuses me because I have a cron job setup on the server to run every 15 minutes. Yet, whatever task I "Run Now" via the extension, it runs it right away, totally disregarding the cron job time frame I have set on the server.

The whole reason I installed the extension was because cron is using 85% to 100% of the CPU and isn't stopping. My host actually had to disable cron.php to get it to stop. I'm thinking it's a bug in 1.9.1.1 because I didn't change anything and this all started after upgrading to 1.9.1.1 from 1.9.1.0.

Since installing the extension, the cron job I have setup on the server will not run (even though it's set to run every 15 minutes) unless I manually execute it by going to my browser and typing it's path directly in the address bar. However, if I do that, I go back to the same issue with CPU usage and cron not stopping.

I like that AOE Scheduler will run jobs (like sending email) on it's own (possibly outside of cron.php), but is there any way to have the schedule actually follow through and work on the extension?


texts: On hover instead of 'click' for mini cart and top account buttons in Magento RWD theme

texts:
Where do i have to change the jQuery functionality to show the drop downs from the 'mini cart' and the 'top-account' on hover instead of click on the desktop versions?

Thanks!


texts: URL Key for product doesn't accept hyphens

texts:
When editing a product I migrated over from a woocommerce store and NOT changing the URL Key I get the following error. Hyphens are a must in URL Keys, what can I do

Thanks!

EDIT: Disabling the translation did little good.

These are the extensions we have enabled:

Cm_RedisSession
Interface_Adminhtml_Default
Interface_Frontend_Base_Default
Interface_Frontend_Default
Interface_Frontend_Rwd_Default
Interface_Install_Default
Lib_Cm
Lib_Credis
Lib_Google_Checkout
Lib_Js_Calendar
Lib_Js_Ext
Lib_Js_Mage
Lib_Js_Prototype
Lib_Js_TinyMCE
Lib_LinLibertineFont
Lib_Mage
Lib_Magento
Lib_Phpseclib
Lib_Varien
Lib_ZF
Lib_ZF_Locale
Mage_All_Latest
Mage_Centinel
Mage_Compiler
Mage_Core_Adminhtml
Mage_Core_Modules
Mage_Downloader
Mage_Locale_de_DE
Mage_Locale_en_US
Mage_Locale_es_ES
Mage_Locale_fr_FR
Mage_Locale_nl_NL
Mage_Locale_pt_BR
Mage_Locale_zh_CN
Magento_Mobile
Phoenix_Moneybookers
MTurbo
Fooman_Speedster
AW_Blog
magento_community_Ebcomm_PaypalMx
Olark_Chatbox


texts: How to customise order state after generating invoice in Magento2

texts:
I'm want to change the order state processing to newly creates order state, when invoice is created for a order. I want to do this programatically.
Anyone help me with this.


texts: How to update tax price in magento on checkout page

texts:
I want to set custom tax rate on magento checkout page. I have written below code but what will be next step i can't understood:
i want if

  taxt == 0 then i am able to apply tax 8% (custom)

<?php
class Sipping_Disable_Model_Observer
{
 public function salesQuoteCollectTotalsBefore(Varien_Event_Observer $observer)
    {
        /** @var Mage_Sales_Model_Quote $quote 778.78*/
            $quote = $observer->getQuote();
            $subTotal = $quote->getSubtotal();
            $newSubTotal = (5/100) * $subTotal;
            $totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals();
            $tax = 0;
            if(isset($totals['tax']) ) {
                $tax = $totals['tax']->getValue();
            }
            $zip = $quote->getShippingAddress()->getPostcode();
            if($tax == 0){
                $con = Mage::getSingleton('core/resource')->getConnection('core_read');
                $sale_rule_result = $con->fetchAll("SELECT rate FROM tax_calculation_rate where tax_postcode=".$zip);
                $tax_percentage = $sale_rule_result[0]['rate'];
                // update tax code goes here ??/

            }
                 Mage::log($zip.'-t-'.$tax, null, 'shipping-price.log',true);

    }
}
?>


texts: left side Attribute filter with checkboxes , Magento2.2.6

texts:
I am using Magento2.2.6 Our requirement is attribute filter with checkbox display on left side layer navigation inside.Not page reload Ajax using filtering.If anyone idea and if this functionality working code please share with me.If have you free extension anyone please share it
,for example i need this type of


texts:
I have a store which sells fresh and frozen food. We need customers to order a minimum of 8kgs of frozen produce to ensure product arrives in a frozen state.

We currently have product attributes called "Fresh" & "Frozen"

What's the best way to have a minimum order (by weight)? Eg dont allow the order if the amount of frozen food is under 8kg


texts:
When I login to my account both during checkout process or through the regular login page I get a white page. After refreshing that page I get redirected to my dashboard, but not before.

My .htaccess file has php_value memory_limit 128M and my index.php has ini_set('display_errors', 1); uncommented. Also my apache logs are not showing any errors.

The form is trying to reach http://www.mywebsite.com/customer/account/loginPost/ and that's where it's stuck in a blank page.

EDIT: On the backend Redirect Customer to Account Dashboard after Logging in was checked to No, changed it to Yes but same thing happens


texts: How to get all Shipping Methods list with shipping rates and shipping tax on cart page?

texts:
I want all available shipping methods list with shipping rates and Tax amount.
I've done below function, though it's giving me shipping methods list with rates but not shipping tax amount per shipping method on cart page
public function getShippingDetails($quote)
 {
     $output = [];
  if (! $quote->isVirtual()) {
        $shippingAddress = $quote->getShippingAddress();
        $shippingAddress->setCollectShippingRates(true);

         $this->_totalsCollector->collectAddressTotals($quote, $shippingAddress);
        $shippingRates = $shippingAddress->getGroupedAllShippingRates();
        foreach ($shippingRates as $carrierRates) {
            foreach ($carrierRates as $rate) {
                $output[] = $this->_converter->modelToDataObject($rate, $quote->getQuoteCurrencyCode());
            }
        }
    }
    return $output;

}

It returns
  [{
    "carrier_code": "freeshipping",
    "method_code": "freeshipping",
    "carrier_title": "Free Shipping",
    "method_title": "Free",
    "amount": 0,
    "base_amount": 0,
    "available": true,
    "error_message": "",
    "price_excl_tax": 0,
    "price_incl_tax": 0
}, {
    "carrier_code": "flatrate",
    "method_code": "flatrate",
    "carrier_title": "Flat Rate",
    "method_title": "Fixed",
    "amount": 5,
    "base_amount": 5,
    "available": true,
    "error_message": "",
    "price_excl_tax": 5,
    "price_incl_tax": 5
}]

The shipping Tax applied 10% , however I'm getting $5 in price_incl_tax for flatrate instead of 5.5
I've tried to fetch the price with tax with below code as well but didn't work
/**
     * Tax data
     *
     * @var \Magento\Tax\Helper\Data
     */
    protected $_taxData;
 $amount =(double)$rate->getPrice();
 $amountInclTax=$this->_taxData->getShippingPrice($amount, true, $shippingAddress);
 $amountExclTax=$this->_taxData->getShippingPrice($amount, false, $shippingAddress);

Can anyone please help me ,how I can get shipping rates with shipping tax amount?
Thanks


texts: How can we set store value in UI form Magento 2

texts:
I have a UI form in admin with store switcher. I need store_id in post data.

As all can see store_id in url when I change store from store switcher but once I submit it I am not getting any store value in post data. So I think I need to set store value in a hidden field. I don't know I am on right track or not. Please help guys if anyone faced this issue before.


texts: Help on creating a Payment Gateway that redirects to Payment Provider

texts:
Can you help me in implementing a simple payment gateway?

Conceptually is very simple but I could not find any documentation that allows me to understand the process and carry it to practice. I have spent 2 days trying to figure it out, but with no avail.

I need to use a payment provider that only left me available a CGI program in my Magento server. That CGI makes a call to the payment provider server which shows a form and allows customer to pay by credit or debit card. From my point of view, that process is transparent. I only need to call that CGI with some parameters, like amount, quote ID, success URL, error URL and other internal variables, all of them passed as POST variables to the CGI. And after payment, a success or error controller will act.

That is all, but I was not able to carry that a simple process to Magento implementation.

First, how to pack the FORM data so that when user presses "Place Order" , the CGI get called passing those parameters?
Second (I think this is the easiest process), to create controllers for both success and error behaviour.

Can you give me a brief guide, please?

Thanks a lot in advance
Jaime


texts: Magento Change Product name added to cart

texts:
i want to change product name to custom name when added to cart:

i wrote below code to change price ,but unable to change product name why so ,what to do for that

<checkout_cart_product_add_after>
    <observers>
        <setadiscountprice>
            <class>Mour_Customgroup_Model_Observer</class>
            <method>modifyPrice</method>
        </setadiscountprice>
    </observers>
</checkout_cart_product_add_after>

observer

public function modifyPrice(Varien_Event_Observer $obs ){

    $item = $obs->getEvent()->getQuoteItem();
    $product_id=$item->getProductId();
    $_product=Mage::getModel('catalog/product')->load($product_id);
    $price=$_product->getPrice();

    $specialPrice = $price+10;

    // Make sure we don't have a negative
    if ($specialPrice > 0) {
        $item->setCustomPrice($specialPrice);
        $item->setOriginalCustomPrice($specialPrice);
        $item->setName('helllloo');
        $item->getProduct()->setIsSuperMode(true);
    }

}


texts: How to add new field in the Default API response

texts:
I need add a new field in the response of cart totals API example.com /rest/V1/carts/mine/totals/. In order to do that, I used new interface which extends the actual interface Magento\Quote\Api\Data\TotalsInterface and created corresponding model which extends \Magento\Quote\Model\Cart\Totals.
Company\MobileApi\Api\Quote\TotalsInterface

    <?php
namespace Company\MobileApi\Api\Quote;

    interface TotalsInterface extends \Magento\Quote\Api\Data\TotalsInterface
    {
        /**
         * free shipping amount.
         */
        const KEY_FREE_SHIPPING_AMOUNT = 'free_shipping_amount';
        /**
         * Get free shipping amount
         *
         * @return float|null
         */
        public function getFreeShippingAmount();

        /**
         * Set ree shipping amount in quote
         *
         * @param float $freeShippingAmount
         * @return $this
         */
        public function setFreeShippingAmount($freeShippingAmount);
    }

Company\MobileApis\Api\Quote\Totals

<?php

namespace Faya\MobileApis\Api\Quote;
    use Faya\MobileApi\Api\Quote\TotalsInterface;

class Totals extends \Magento\Quote\Model\Cart\Totals implements TotalsInterface
{
    public function __construct(
        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
    ) {
        $this->config = $scopeConfig;
    }
    /**
     * Get free shipping amount
     *
     * @return float|null
     */
    public function getFreeShippingAmount() {
        return $this->getData(500);
        //return $this->config->getValue('carriers/ups/free_shipping_subtotal');
    }

    /**
     * Set grand total in quote currency
     *
     * @param float $freeShippingAmount
     * @return $this
     */
    public function setFreeShippingAmount($freeShippingAmount) {
        return $this->setData(self::KEY_FREE_SHIPPING_AMOUNT, 500);
    }
}

Then in the API main class

public function __construct(
        \Company\MobileApi\Api\Quote\TotalsInterface $totalsFactory
    ) {
        $this->totalsFactory = $totalsFactory;
    }
public function get($cartId)
    {
        $quote = $this->quoteRepository->getActive($cartId);
        $quoteTotals = $this->totalsFactory->create();
        $this->dataObjectHelper->populateWithArray(
            $quoteTotals,
            $addressTotalsData,
            '\Company\MobileApi\Api\Quote\TotalsInterface'
        );
        $items = [];
        foreach ($quote->getAllVisibleItems() as $index => $item) {
            $items[$index] = $this->itemConverter->modelToDataObject($item);
        }
        $calculatedTotals = $this->totalsConverter->process($addressTotals);
        $quoteTotals->setTotalSegments($calculatedTotals);

        $amount = $quoteTotals->getGrandTotal() - $quoteTotals->getTaxAmount();
        $amount = $amount > 0 ? $amount : 0;
        $quoteTotals->setCouponCode($this->couponService->get($cartId));
        $quoteTotals->setGrandTotal($amount);
        $quoteTotals->setItems($items);
        $quoteTotals->setFreeShippingAmount(200.00);
        //return $quoteTotals->setFreeShippingAmount(200.00);//return []
        return $quoteTotals;
    }

In the response of API, I'm not able to get the new variable.

I think, I'm missing something to get a variable in response. Can anyone help on this?


texts: Get all blocks including a specific substring?

texts:
Is it possible to return all blocks which contain a specific substring?
e.g. return all blocks which contain the substring slider_.

I know I can return all blocks loaded in the current page like this:

$allBlocks = Mage::app()->getLayout()->getAllBlocks();
$blockNames = array_keys($allBlocks);

var_dump($blockNames);

But how can I get ALL blocks, even blocks not loaded at the moment, so I can filter the necessary ones with the target substring out?

Which way is recommended to achieve this?


texts: Magento 2 Proxy Classes best way Used vi constructer or Di.xml

texts:
I have read many docs regarding to proxy classes which is automatically generated by Magento 2 to stop the chain reaction of object instantiation.
These docs definition told us that proxy classes should be define via the di.xml and must NOT be specified in the __ constructor method.
But when I checked some third party module like Amasty and found that they define the Proxy in __ constructor method.

e.g.  path of file: app/code/Amasty/ShopbyBase/Model/Category/Manager.php

in __construct method pass below proxy

\Amasty\ShopbyBase\Model\Category\Manager\Proxy $categoryManager,

and example file is

app/code/ShopbyBase/Block/Adminhtml/Catalog/Product/Attribute/Edit.php:

 \Amasty\ShopbyBase\Model\Source\DisplayMode\Proxy $displayModeSource,

Above examples make me confused because as per definition that proxy classes define only via di.xml.

if anyone have idea about it,please let me know how we should use proxy via xml or via __construct method.


texts: getCustomerGroupId from order in invoice template

texts:
I'm trying to put some custom text in an invoice template (a transactional mail). I am doing this by loading a block in the template. In here i want to use some logic to display some text based on GroupId.

In Invoice_new.html

{{block type='core/template' area='frontend' template='mailcomment/mailcomment.phtml' order=$order}}

**In my new file mailcomment.phtml

<?php $customergroup = $this->getData('order')->getCustomerGroupId();
if ($customergroup==7)
echo ("Some custom text")?>

Unfortuntely this does not work. Can anybody tell me what i am doing wrong?


texts: How to show short description via invoice admin panel

texts:
I want show short description via admin admin like this image.

Please tell me how to show it.
Thanks.


texts: Understanding cancellation and refund process (i.e. how to handle cancelled but paid orders)

texts:
So I got banned from #magento on freenode for asking details about this to understand the underlying process flow. :D

I get the problem that:

a product is ordered
an invoice is send
a payment is triggered by a payment provider via wire transfer
a notice comes that the product can't be delivered
I check if the invoice was paid
if it wasn't I cancel the order
now money from the customer arrives

Now I'm stuck as I can click to refund the order but the total amount is zero as I cancelled the order already.
This can happen all the time, and seems to be the case if you google for it, because i.e. the wire transfer just takes some time, the customer mixes up the payments and tells you he hasn't paid yet or something alike. You can't wait to cancel for weeks just to be sure the customer doesn't pay, can you?

What workflow does magento have here? You can't cancel the cancellation, you can't refund the order, you can't tell it that it was "overpaid" so to speak. It seems you can't do anything here.
The only thing I came up with was to mingle through the database and revert the cancellation so I could refund again.
I found a lot of code snippets online to do so, which in my opinion hints at something.

I really like to understand the thinking / process here.


texts:
I have multiple EC2 servers running magento 2.2.5 application. I am using Cloudfront CDN for pub/media serving and the source is s3 bucket.Also I have a cron at every 1 minute that sync pub/media to s3 bucket.

Now I want to do same with my pub/static folder I created the similar 1 min cron but the issue is static folder has _cache folder that creates the js and css cache dynamically and when user opens the website and the cron yet haven't upload the file to s3 the user sees broken page of website.

Any solution for this for syncing it to bucket properly or any additional plugin / customisation might work?


texts: Magento 2 Create Module with same frontName as other module?

texts:
I have to extend functionality of Magento_Customer module and new some more controller under customer/account like customer/account/mobileVerification so my question is, Is okay to have the same frontName customer for another Module Vendor_Customer in app/code/Vendor/Customer/etc/frontend/routes.xml.

Will it create issues ? or is it okay to do so.


texts: Show "dropdown" attribute type on product grid

texts: I have a product attribute for configurable products as a "dropdown" and I would like to show it on product listing/grid how can I do this?


texts: magento 2 fetch PO number from checkout page into my custom table?

texts:
I have enabled the Purchase Order payment method from magento backend.
The PO payment method takes a input field data and stores into Sales_order_payment table as po_number.
i want to fetch the same value of the input field after place order and store it into my custom table.

currently i am using the following in my observer for checkout_onepage_controller_success_action event.

protected $_dataObject;

\Magento\Framework\DataObject $data,

$this->_dataObject = $data;

$po_number = $this->_dataObject->getPoNumber();

The current code is not giving me the po number.
Please help !!


texts: Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)

texts:
We are having some issues when a customer try to remove the last (one) item from the shopping cart before it becomes empty, the only message that comes up is: We can't remove the item.

I have no idea why or how to fix it, or at least how to debug it.

Any help is appreciated.

Thanks

UPDATE - SOLUTION IN MY CASE

Posted by @ivankaranjac on this Post :

  Problem with deleting, updating and adding to cart once an item is
  added to the cart

  traced the problem to
  vendor/magento/module-quote/Model/ShippingAddressManagement.php#120

  commented out that if and it all seams to work fine now.


texts:
Hi I am Developing Feature Product Module so that i create all necessary Folders.

My Problem is

I Created Namespace/Module/Block/Index.php

 <?php
class MPS_AllProduct_Block_Index extends Mage_Core_Block_Template{

    /**
    * Get Feature Product
    **/
    public function FeatureProduct(){
        $_productCollection = Mage::getModel('catalog/product')
            ->getCollection()
            ->addAttributeToSelect('*')
            ->addAttributeToFilter('status', array('eq' => 1))
            ->addAttributeToFilter('visibility', 4)
            ->addFieldToFilter(array(array('attribute'=>'feature','eq'=>'1'),))
            ->joinField('is_in_stock',
                'cataloginventory/stock_item',
                'is_in_stock',
                'product_id=entity_id',
                'is_in_stock=1',
                '{{table}}.stock_id=1',
                'left');
            return $_productCollection;
    }
}

my.phtml

$featue = $this->FeatureProduct()
foreach($feature as $_product){
   echo $_product->getName();
echo $this->getPriceHtml($_product, true); // it's not working
echo $this->getReviewsSummaryHtml($_product, 'short') //it's not Working

}

So i check one extension that's is paid one they created folder called

Block/Feature/List.php

public function _getProductcollection(){
   /********
     code
   *******/
}

it's working fine what is the difference between these two which one is proper way


texts: Programmatically simulate a shipping rate request for a specific weight (for testing purposes)

texts:
How can I more quickly test different shipping scenarios?

I have a client that is asking for some changes to some [already] very complex shipping logic. We are using a module to "override" the shipping methods' availability and price.

I have been testing each weight class manually, by adjusting the quantity of a product to get my cart to have a specific total weight.

In theory, I should be able to make a utility that shows me each outcome on a single page, but so far all my attempts have failed.

I have already tried to:

Set the weight on a pre-existing quote object, then collect the rates.

$address = $quote->getShippingAddress();
$address->setWeight($my_custom_weight)->collectShippingRates();

This does not work because collectShippingRates re-collects the product weights before actually summing everything up.
I have also tried to create my own shipping/rate_request object, and call Mage::getModel('shipping/shipping')->collectRates($request);.

This won't work for me because the override rules are applied by an overridden Mage_Sales_Model_Quote_Address_Rate class, which never gets called unless you request the rates through the address model.
I have tried to programmatically modify my quote such that the product quantity gives me the desired weight (for example, I have a product that weighs 1lb, I want to "test" 10lb, so it sets the qty to 10, saves the quote, then requests the shipping rates.) This seems to work at first, but not when I try to do it 4 times in a row. Each subsequent request pulls the rates from the sales_flat_quote_shipping_rate table, showing the same rates as the first test.
Last resort (haven't tried yet) is to create 4 separate carts/quotes, then loading the quote by ID to get the shipping options. I really don't like this solution because it isn't very reusable.

Background: To create the logic initially, I opened 3 browser windows (Firefox + Chrome + Incognito) in order to have 3 different carts (with 3 different weights.) This made it very easy to test and make sure that all 3 weight classes work as specified by the client.
Previously there were 3 weight classes, but now there are 4, each with different available methods/pricing overrides/markups.
Now that they have a 4th weight class, it seems like I should find a more efficient way of doing this.


texts: (Magento2) How to change template of category page depending on category level?

texts:
I want my level 0 category to have a different layout from level 1,2...How can I do this by code or by admin page?

Thanks!


texts: Add Button to Order Details Page in Admin Panel

texts:
I was looking for some help to create an extra button in the area in the screen shot below. Basically, I have created a Custom Transactional Email which I would like to use to send to customers if their order is going to be delayed slightly.

In other words, if the product they ordered is on backorder, I just want a way to send a quick email stating their order is going to be delayed since the product is in production.

Most of our products can be manufactured in a day if need be. We end up building to order at certain times of the year, since the order volume trumps our capabilities.

We can not really use the Back Order feature of Magento 1.8.1 simply because we sell products on other sites rather than just our own. So we have to keep a running total of inventory for everything instead of just Magento.

Any help with this topic will be greatly appreciated. I have not had to do much to our website in the past year so a little rusty.

Thanks,

Ryan


texts:
I am setting up a Magento CE store for a friend and have a question regarding product variations.

He sells awnings and sun-blinders to people and have a product with the following specifications:

There are 3 depths for an awning: 2 meters, 3 meters and 4 meters
And multiple sizes in widths, but prices are pr. 50 cm and he want the customer to be able to write the exact measurement in the page.

Example: 2 meter depths and 3,55 m width is calculated down from: 2 meter depths and 4 meter widths. The product is simply cut down from the next possible width size.

I really hope any of you have an idea how to code this up or maybe knows an extension that deals with these type of products.

Thank you in advance


texts: Magento 2 Checkout - How to replace labels with placeholders

texts:
In the Magento 2 Checkout, i need to replace the form input labels (Firstname, Lastname, City etc) with placeholders (text that will show inside the input box).

I found this solution https://diweirich.com/magento-2-using-placeholders-in-form-fields/ but not sure if this is the correct approach as it overrides labels to be considered placeholders.

And here the same workaround is suggested Add placeholder and remove all labels in Magento 2 Checkout

Any solution is welcome.


texts: Dynamic rewrite of the payment/data helper

texts:
I'm currently going through the Magento Developer Certification Preparation Study Group Guide and doing the exercises. I've come across the following question and I have no idea what to do with it:

  Create a dynamic rewrite of the payment/data helper only if the version of Magento is older than version 1.4, and if the ccsave payment option is enabled for the current store.

I can get the version number with Mage::app()->getVersion() and and check if ccsave is is enabled with Mage::app()->getStoreConfig('payment/ccsave/active/') but as far as I can tell one can't use these in their config.xml.

I also thought I might be able to do these checks in the _construct() method but there doesn't seem to be one for Mage_Payment_Helper_Data

Any ideas?


texts: creating a product catalog prior to hiring design/development team?

texts:
I work with a specialty retailer which has a heavily trafficked static html web site but which has never had a fully functional shopping cart - we take orders via e-mail and phone and also have a secure online order form which customers can fill in manually. We are now looking to migrate to an e-commerce platform, most likely Magento.

The products we sell are specialized and often very complex, with multiple attributes and available in multiple configurations. Given this complexity, and as a first step towards sending out proposals to designers and developers, would it make sense to first try and create the product catalog ourselves using Magento Community Edition? Or would creating the product catalog ourselves prior to hiring a design/development team create potential problems?

I’m curious to hear feedback from designers and developers about this. We have adequate but not unlimited funding for this project, and creation of the product catalog (we have over two thousand individual products) would seemingly be the most time-intensive part of the project. Thanks in advance for any guidance...


texts: Methods are called before Jquery is init

texts:
I have a lot of errors in my magento 2 site.
Seems that functions are called in a strange way.
(They're in head, and they're supposed to be in the body)
How can i solve this?


texts:
How can i use user agent in mobile for different view?
I mean want to see different webpage on mobile from desktop
any suggestion?
Know it on PHP on Magento2 i don't know how to use it


texts: How to exclude the category from the shopping rule in magento?

texts:
i am wanted to apply the discount rule on all the categories in my store except one category . i am going with the following rule.
This rule works fine if i add the product from categories other then 85. but when i add the product with category 85 and also add other category products then rule stop working.
How to achieve this scenario??


texts: Blank getShippingAddress OR getShippingDescription in transactional emails?

texts:
I'm having some trouble with getting two variables to appear in outgoing new order emails.

Essentially, Magento will only populate one of either:

  {{var order.getShippingAddress{}.format('html')}}

  {{var order.getShippingDescription()}}

And never the two together in the same email.

I've tried splitting them out into separate parts of the email (thinking maybe the html format of addresses was breaking its container) but still to no avail, even if I remove the {{depend}} clause and put the variables inline together.

I'm on 1.9.01 and using Mandrill for transactional emails; avoiding config.xml and using the System -> Transactional Emails section to input custom HTML. The section of the table is here:

http://pastebin.com/Vwe8ANE7

Any ideas, or guidance in troubleshooting? Mandrill and Magento logs aren't really helping - they simply generate a blank span or td where the information should be!


texts: How to override js file of base folder in Magento_Ui?

texts:
I want to override the sizes.js in location:

  /vendor/magento/module-ui/view/base/web/js/grid/paging/sizes.js

I want to remove "Custom" and "200" options from admin grid per page dropdown.


texts: magento2 Saving attribute from quote_address to sales_order_address

texts:
What i would like to do is to save a custom attribute in quote_address called: COC (Chamber of Commerce).
This attribute can be different from billing address and shipping address. That's why it's saved there.
It is getting saved in the quote_address.

Now what i want to do is to copy those values to sales_order_address.

Steps i tried:

specify the fieldset like this:

<fieldset id="sales_convert_order_address">
    <field name="coc">
        <aspect name="to_quote_address" />
    </field>
</fieldset>

Adding the attribute using a observer:

$order->setCoc($quote->getCoc());

What i think is the problem is that fieldset.xml doens't get processed.
So it doesn't know that i want to save it to sales_order_address.

How can i set an attribute in sales_order_address using the observer event: sales_model_service_quote_submit_before

Your help is much appreciated!


texts: Error on retrieving attributes in sidebar

texts:
I am trying to pull my attributes inside sidebar with the following code:

$attributeValue = Mage::getModel('catalog/product')
        ->load($_product->getId())
        ->getAttributeText('weight_category');
echo $attributeValue;

But I get this error:

Fatal error: Call to a member function getId() on a non-object in

Any idea?

UPDATE (from srdan)

I work with Josip on that project. The problem is that everytime we want do something with $_product object the error:

Fatal error: Call to a member function getId() on a non-object in /path/to/template/where/code/is.phtml

shows up. We use  code below and error above shows up on frontend:

<?php
    $_helper = $this->helper('catalog/output');
    $_product = $this->getProduct();
?>

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

Attribute: <?php echo $_helper->productAttribute($_product, $_product->getSidebar(), 'price') ?>

<?php else: ?>

No Attribute text here!

<?php endif; ?>


texts:
I have the following problem:
I want to get the final price programatically but it always displays 0
I tried with :
$product->getSpecialPrice();

$product->getPriceInfo()->getPrice("final_price")->getValue();

both displays 0
On the other hand $product->getPrice() displays the normal regular price correctly
Is there an other way to get the special price?
I get the products like this:
$collection = $block->getResourceModel('catalog/product_collection')
    ->addAttributeToFilter( 'sku', array('in' => $alle_skus) )
    ->addAttributeToSelect('name')
    ->addAttributeToSelect('thumbnail')
    ->addMinimalPrice()
    ->addFinalPrice()
    ->addTaxPercents()
    ->load();


texts:
I have a custom logger for magento2.
Now i want for in the admin grid to change the table row color based on the status of the row.
For example a row got status: warning, the table row has to be orange. What is the correct way to get this done.

Thanks.


texts:
I have set a session value in admin by below code

Mage::getModel('core/session')->setAutoWebsiteId(1);

But when I get this session value in frontend by code below it returns nothing.

Mage::getModel('core/session')->getAutoWebsiteId();


texts: MySQL Down, Magento throws error on index with MySql Password etc

texts:
I was just monitoring my magento website, and all of a sudden mysql went down for few seconds and Magento throw an error visible for everyone on the homepage / index. This error contained the MySql Password & User ID... If somebody else is monitoring the website as I did, they for sure now know the password of MySql...

How can I disable Magento from outputting any kind of errors on the frontend?!?!

here's the error (those in red are the password and id)

http://i.imgur.com/KfYqWYq.jpg


texts: Magento2 - Extra slash in thumbnail path shows broken images in file upload

texts:
I'm using Magento2.3.3.

I'm attempting to switch my images to S3 and I have updated my media URL to my amazon s3 bucket. The images are there and browsing the front-end works and correctly loads the images.

However, the Upload Image page on the backend (which comes up when managing block content) serves the thumbnail with an added slash between the media URL and the path, giving me a page full of broken images.

I can see from our live server that it is doing it there, too, but when it shows as a path divider (mydomain.com/pub/media//file/name.jpg) it seems to resolve just fine, but as a URL separator (https://mys3.amazonsaws.com//file/name.jpg) the image shows broken URL.

Does anyone know how I could fix this backend page to correctly load the thumbnail image URL?


texts: Automatically set product "in stock" after credit memo

texts:
Is there a way to set the product's stock status automatically to "In Stock" after a credit memo has been created and quantity is restored?

Or would it somehow be possible to set that setting automatically to all products that has qty > 0?


texts: Redirect for urls with filename and query string

texts:
I basically know how to import and redirect urls with the Magento URL Rewrite Tool.

Now I have the case that I need to redirect

shop/shop.php?blbla=238746t2345 to the product.

I prepared and imported everything but as the string contains .php it seems to be ignored by the rewrite tool.

Is there any workaround for this?

Could I rewrite maybe shop.php to shop-php by htaccess before and the rewrite it again with the rewrite tool?

What would be the htaccess directive for that?


texts: Request a Quote for normal customer - Magento 2.2.2 EE

texts:
Recently I installed B2B extension on Magento 2.2.2 EE. Request quote features only available on company account.

is it possible normal customer send request quote?


texts: Whats the best way to remove Out of Stock text

texts:
I'm having trouble displaying the out of stock size without text "Out of Stock".

Example:

And here is how its showing up in DOM:

25 (Out of Stock)

Also here is the jQuery piece that adds class to this span:

jQuery(".ui-segment span.option:contains('(Out of Stock)')").addClass('out-of-stock');

Is there a way to strip out the text "(Out of Stock)"?

or can I somehow generate only Size number eg:

"25" without text "Out of Stock"?
So that instead of 25 Out of Stock it displays as 25


texts:
I have an issue with my Magento installation (Version 1.9.2.2). It works in every browser (tested with Chrome, Safari, Firefox, and Opera) but not in Internet Explorer.

In IE, Magento doesn't set any cookie. I can put an item in my cart and view my cart – and it's empty. Even the Cookie Law Compliance-cookie (when the user clicks "Accept") isn't set so you click on "Allow" and at another page, the message with Cookie Law which you have to accept is there again.

Here my settings for cookies in backend:
Cookie Lifetime: 86400
Cookie Path: /
Cookie Domain: ..de (my correct domain is inserted)
Use HTTP only: No
Cookie Restriction Mode: No

I have tried to set the "Use HTTP only" to Yes and it doesn't work. I've edited the Varien.php and it doesn't work. Magento sets cookies in every browser but not in IE.

Hope you understand my problem. Do you have any ideas?


texts: Custom Options not updating price - JS error

texts:
I've come across a bit of a strange error when making products with custom items. This happens for both simple items and bundle items with fixed prices. When selecting one of the custom items, the 'Price As Configured' value will not update, instead it throws up the error

Uncaught TypeError: optionsPrice.addCustomPrices is not a function

When you add the product to the basket the correct price is displayed, but the live price on the product page is not. If the product is a bundle, then changing the 'bundle items' will update the price as you'd expect.

I've tried displaying the page in the default package/theme to make sure there were no layout changes, and the only non-standard extension I have installed is Worldpay. Can anyone offer any suggestions as to where the problem may be?


texts: Is it possible to inject a value from store config, or alternatively from a helper class (similar to m1 layout xml) into a class using di.xml?


texts:
Hi I want to reposition the static block that I set on Display Setting under a specific category. I want the static block below the category grid view.

This is my code

<layout>
  <CATEGORY_49>
    <reference name="product_list_toolbar" >
        <action method="setData"><data>_current_grid_mode</data><mode>grid</mode></action>
    </reference>
    <reference name="product_list">
        <action method="setColumnCount"><count>5</count></action>
    </reference>
  </CATEGORY_49>
</layout>

How can I do that?


texts: Need to override \Magento\OfflineShipping\Model\Carrier\Freeshipping

texts:
I need to override the collectRates() function in file (\Magento\OfflineShipping\Model\Carrier\Freeshipping) file.

I want to hide CarrierTitle & MethodTitle on the checkout page so I am planning pass set blank CarrierTitle & MethodTitle for that I need to override collectRates() function


texts: How to edit file in app/design/frontend without having to redeploy static content in Magento2?

texts:
Using Magento2, version 2.19

We are editing below file:

  app/design/frontend/xx/xxxxx/Magento_Newsletter/templates/subscribe_popup.phtml

How can I show the changes to this file in the frontend of the site, without having to redeploy the static files from command line every time?


texts:
I was wondering how to use the getBaseUrl() in controller/helper class..

anybody have idea ?


texts: How to display core Country of Manufacture attribute in layered navigation?

texts: I like to have core Country of Manufacture attribute displayed in the layered navigation but it seems simply selecting one of the "Filterable" options in Use In Layered Navigation field is not outputting anything. Is that possible with this core attribute or best to just create a new attribute and manage the country of manufacture data from there?


texts:
I'm trying to translate a button when you are in checkout and you click "Add new address", a popup comes up where you can add a new address.
At the bottom on that popup there is 2 buttons, one called "Ship here" and one called
"Cancel" I would like to translate "Ship Here" but when i use Translate inline,  there is no option to translate this. Anyone here knows where i can find the code to translate the button? Can't seam to find it anywhere.


texts:
we are using Magento 2.2.6 an rebuilding the desing. We plan to move the minicart when the width is small (on smartphones). But we cant do this with css. When we initialize the minicart twice in phtml and working with css

  ($this->getChildHtml("minicart"); in phtml with visible-xs div around

  ...

  ($this->getChildHtml("minicart"); in phtml with hidden-xs div around

the minicart is not functional (while no errors in console).

Can we "copy" the minicart in the xml (default.xml) and work with minicart and minicart2 in the phtml?

  $this->getChildHtml("minicart");
  $this->getChildHtml("minicart2");


texts: magento 2.1.2 installation stuck on Theme

texts:
I'm trying to install magento 2.1.2 on CentOs host but its just stuck withot any error

Module 'Magento_Theme':

Installing data...

what should i do?


texts:
I have been trying to get children categories from certain category. And recently i discovered that some child categories are not displaying. After several hours of trying to figure out what's wrong. I found that in MySQL database those categories not displaying who has column level equal to 3. Witch is fine because my category tree is:

Root
--PublisherParent
---Publisher

And what is strange that when i set level to 0 in Mysql database in catalog_category_entity table, categories start to display...
My code is:

$publisher_cat_id = 13;
$subPublishers = Mage::getModel('catalog/category')->load($publisher_cat_id)->getChildren();

$publisher_names = array();
foreach(explode(",",$subPublishers) as $item)
{
    $_cat = Mage::getModel('catalog/category')->setStoreId(Mage::app()->getStore()->getId())->load($item);
    array_push($publisher_names,$_cat->getName() . "," . $_cat->getUrl());
}

Anyone had this issue?
Please let me know if you know how to fix this.


texts: How to filter data using multiple attributes?

texts:
I would like to get data with pre_order = 1 and if pre_order_due_date is gt than and id ls than so in my code I did:

$preordered = Mage::getModel("catalog/product")->getCollection()
->addFieldToFilter(
array(
      array('attribute' => 'pre_order', 'eq' => '1',
      array('attribute' => 'pre_order_due_date',
      array( 'gt' => $from, 'lt' => $to)
     ))));

It works but as a result I'm getting too many products, date filter seems not to work properly.
What should I change to make it work as expected ?


texts: When enable persistence shopping cart welcome Header 'remembered account' html link broken

texts:
I enabled the persistence shopping cart option from store configuration. when user logging out, displaying raw HTML tags bound with the username in the header.
what would be a possible reason this can happen.
Please check the below screenshot


texts: How to add option of add to cart for simple products on bundle product page?

texts:
I have got a situation where I need to place a button of add to cart for every simple product on bundle product page. So that customer can order that particular simple item of bundle product individually.

Any one have any guess how should i do that.

Please reply

Thanks in advance


texts:
I install magento devbox based on docker on windows10pro. And get error

  ERROR: for web  Cannot create container for service web: invalid bind
  mount spec
  "C:\magedevbox\shared\logs\php-fpm:/var/log/php-fpm:rw": invalid
  volume specification:
  'C:\magedevbox\shared\logs\php-fpm:/var/log/php-fpm:rw'

  ERROR: for db  Cannot create container for service db: invalid bind
  mount spec
  "C:\magedevbox\shared\var\logs\mysql:/var/log/mysql:rw": invalid
  volume specification:
  'C:\magedevbox\shared\var\logs\mysql:/var/log/mysql:rw'
  [31mERROR[0m: Encountered errors while bringing up the project.
  ERROR: No container found for web_1

  Install Magento

  [31mERROR[0m: No container found for web_1


texts: DELETE V1/addresses/:addressId - This Rest API is not working with Customer Token

texts:
delete /V1/addresses/{addressId}

This is the Delete Address REST API in Magento 2.

It works with admin token , but not with customer token.

I think it should be working with customer token as customer should have rights to delete his own addresses stored.

This API has access permission for Resource : Magento_Customer::manage

This resource permission should be working with customer token, isn't it ?

Does anybody having the same issue ?


texts: How to display tax details at item lines in invoice?

texts: I browsed the tables and discovered that tax rates, codes, etc are saved at order level. How can I display tax summary having tax code, rate, etc at each item line in invoices generated from backend?