texts: Incorrect Backend Url from getUrl() method

texts:
I am trying to write link to Payment Transaction to Oder's comment.

But it seems UrlBuilder generates incorrect security key for the link.

Link from transaction page:

  backend/sales/transactions/view/txn_id/4/key/107dd581bc9af9c35f8069181a5ebe7195c9cc3d96936201fb9a4a53b4960dd9/

Link from comment:

  backend/sales/transactions/view/txn_id/4/key/3711f2bda03d84cfc34662e93697d94ac73b27061e2c1144cd7edd32e88adddc/

public function __construct(
    \Magento\Backend\Model\UrlInterface $urlBuilder,
 ...
) {
    $this->urlBuilder        = $urlBuilder;
...
}

$this->urlBuilder->getUrl(
    'sales/transactions/view',
    [
        'txn_id' => $txnId
    ]
);

Where am I wrong?


texts: Add products to cart using \Magento\Quote\Api\CartRepositoryInterface

texts:
I'm trying to add products to cart programmatically using \Magento\Quote\Api\CartRepositoryInterface since \Magento\Checkout\Model\Cart is already deprecated. My code is successfully being inserted in quote, quote_item table and other tables. but it's not creating any entries in quote_id_mask table. I don't know what's lacking in my code.
Not also sure if it's the problem that's causing the product to not appear in the front end.
public function __construct(
    Context $context,
    \Magento\Checkout\Model\CartFactory $cartFactory,
    \Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
    \Magento\Quote\Model\QuoteFactory $quoteFactory,
    \Magento\Quote\Model\Quote\ItemFactory $quoteItemFactory,
    \Magento\Quote\Api\Data\CartInterfaceFactory $cartInterface,
    \Magento\Quote\Api\CartRepositoryInterface $cartRepositoryInterface,
    \Magento\Quote\Api\Data\CartItemInterfaceFactory $cartItemInterface,
    \Magento\Store\Model\StoreManagerInterface $storeManagerInterface,
    \Magento\Framework\HTTP\PhpEnvironment\RemoteAddress $remoteAddress
){
    parent::__construct($context);
    $this->cartFactory = $cartFactory;
    $this->productRepository = $productRepository;
    $this->quoteFactory = $quoteFactory;
    $this->quoteItemFactory = $quoteItemFactory;
    $this->cartInterface = $cartInterface;
    $this->cartRepositoryInterface = $cartRepositoryInterface;
    $this->cartItemInterface = $cartItemInterface;
    $this->storeManagerInterface = $storeManagerInterface;
    $this->remoteAddress = $remoteAddress;
}

public function execute()
{
    $request_data = [
        ['sku' => 'product-sku', 'type' => 'sample']
    ];

    $cart = $this->cartInterface->create();
    $cart->setStoreId($this->storeManagerInterface->getStore()->getId());
    $cart->setRemoteIp($this->remoteAddress->getRemoteAddress());

    foreach($request_data as $request){
        $product = $this->productRepository->get($request['sku']);

        $item = $this->cartItemInterface->create();
        $item->setProduct($product);
        $item->setQty(1);

        $cart->addItem($item);

        $this->cartRepositoryInterface->save($cart);
    }

    die('test');
}


texts: How to solve jQuery autocomplete is not a function in Magento2.2.5

texts:
Here is my script, I don't know what is the problem but it show JQuery autocomplete is not a function in console.

Any help would be appreciated.

<link href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel
="Stylesheet"></link> <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js" ></script> <script>
    <?php
    $zipdata = array();
    $zipval = array();
    $zipdt = array();
        foreach ($storeCollection as $key => $value){

            if ($value['latitude']==0 || $value['longitude']==0){
                continue;
            }
            $lab = $value['name'].', '.$value['city'].', '.$value['state_province'].', '.$value['postal_code'];
            $zipdata[]  = $lab;
            $val = $value["location_id"];
            $zipval[] =  $val;
            //$zipdt[] =  {"value":$val ,"label": $lab};
        }
        if(count($zipdata) > 0){ ?>
            require(['jquery', 'jquery/ui'], function($){
                jQuery(document).ready(function(){

                    var zipdata = <?php echo json_encode($zipdata); ?> ;
                    var zipval = <?php echo json_encode($zipval); ?> ;
                    var i;
                    var zipdt = Array();
                    for (i = 0; i < zipval.length; i++) {
                      zipdt[i] = {"value": zipdata[i] ,"id": zipval[i]};
                    }
                    //console.log('zipdt',zipdt);
                    jQuery( "#retailer" ).autocomplete({
                        source: zipdt,
                        select: function (event, ui) {
                            var value = ui.item.value;
                            var label = ui.item.id;
                            jQuery("#retailerid").val(label);

                        },
                        change: function(event, ui) {
                                  if((ui.item === null)){
                                    jQuery("#retailer").val("");
                                  }
                              },
                    });
                });
            });
        <?php } ?> </script>


texts: On the page layouts 1 column, 2 columns, 3 columns, there is always a div called "columns" in it. I would like to create a page layout, where that div does not exist. How can I do that? Where is that file / where do I need to copy it to my theme?


texts: Magento 2 default login as customer previously logged in customer logout and new customer redirect to login instead of successful login

texts: Clicked out of Ghost in session without closing customer session and when I went to ghost back in it takes me to login page instead of back into the customers account.if i closed session from close button then it login successful another customer.but already logged and try to new one the it logout previous and redirect to login page.instead of successful.


texts: Subtotal vs Subtotal (Excl. Tax) when creating a condition for discount rule

texts: I'm creating a coupon code with a minimum order amount. While adding a condition, I'm not sure the difference between Subtotal and Subtotal (Excl. Tax). Could anyone help?


texts:
I saw many such questions, but all answers are basically copies of the same solution with custom theme.
Is it possible just to override core file

  vendor/magento/module-sales/view/frontend/templates/email/shipment/track.phtml

without creating a custom theme? If so, what exactly path should I create to put altered track.phtml to?
My intention is to make collection of altered files that will not be overwritten during Magento or 3rd party theme automatic upgrade so I can easily keep all core functionality changes. And this will allows me to keep changes even if theme is switched to another one.
Thank you.


texts: Magento 2 - product image in product description page is incorrect

texts: I imported csv file to upload product image in magento 2. The upload image is displaying only in category list page and shopping cart page. In product description page a different image from uploaded one is displaying And that the same image displaying in magento admin product image section. why this is happens and how to resolve this one.


texts: Stripe - Please check the shipping address information. "regionId" is required Error while Billing and Shipping Address is different

texts:
User is getting error Please check the shipping address information. "regionId" is required while user already entered the Shipping and Billing details in the shipping and payment details form.
User selected payment method as Stripe with putting billing and shipping address different.
We received Payment Transaction Failed Reminder email with following details -

User is not able to check-out after this error.
Please help as state and all details are filled correctly then why the user is getting this error?


texts: Magento coupon code generate some % off for next order

texts:
I want to generate the coupon 30% off for next order. means suppose any customer already bought one product from our store than they get 30% off on next order.

How can I generate this coupon in Magento 1.9.1


texts: Is there any way to automaticly add a product to a product-page when the product gets a special price?

texts:
Is there any way that when I give a product a special price, it automatically adds the product to a special "Sale" page at my homepage without manually adding the product to any type of category?
So that I can press the selected "Sale" page in the top and all the special priced items are on that page?

I hope someone can help! Thanks ;)

Rob


texts:
When I use this code in layout Everything is good

<PRODUCT_TYPE_bundle>
    <reference name="head">
        <action method="addItem"><type>skin_js</type><name>js/chocolatebox/chocolatebox.js</name></action>
        <action method="addItem"><type>js_css</type><stylesheet>chocolatebox/css/style.css</stylesheet></action>
    </reference>
    <reference name="product.info">
    <action method="setTemplate">
        <template>chocolatebox/chocolatebox.phtml</template>
    </action>
</reference>
</PRODUCT_TYPE_bundle>

But I want to apply to my template using blocks. When i doing this my template is destroying

<?php
class Chocolate_Box_Block_Catalog_Product_View extends Mage_Catalog_Block_Product_View
{

    public function _beforeToHtml(){
//       /die();
       $this->setTemplate("chocolatebox/chocolatebox.phtml");
    }
}

config

<blocks>
        <chocolatebox>
            <class>Chocolate_Box_Block</class>
        </chocolatebox>
        <bundle>
            <rewrite>
                <catalog_product_view_type_bundle_option_radio>Chocolate_Box_Block_Catalog_Product_View_Type_Bundle_Option_Radio</catalog_product_view_type_bundle_option_radio>
            </rewrite>
        </bundle>
        <catalog>
            <rewrite>
                <product_view>Chocolate_Box_Block_Catalog_Product_View</product_view>
            </rewrite>
        </catalog>
    </blocks>


texts: There has been an error processing your request in magento

texts:
I have installed some plugin.After installing it displaied some error.

How to fix that? I am using Magento 1.9

There has been an error processing your request
Exception printing is disabled by default for security reasons.

Error log record number: 1558115809

I am using magento 1.9 version
I added this plugin
https://www.magentocommerce.com/magento-connect/izberg-marketplace-multi-vendor-multi-seller-drop-ship-solution-in-saas.html


texts: Magento 2 - WYSIWYG uploaded images resized to 500px wide. How can I prevent this?

texts:
When uploading large images to be used within a block or page, Magento 2 resizes them to 500px width.
I don't want that instead I want them left at their original size.
I have no extensions installed apart from my theme which is Ultimo. Help!!!


texts: Magento 1.9 - how to recover manually orders from orphaned transactions

texts:
From time to time I'm getting orphaned transaction (Sagepay Suite PRO).
As module developers actually are unable to help sort this out, maybe someone found the way how to recover these orders.

Recovery function mostly does not work (mostly because once or twice only I was able to do it) since then all I'm getting is "The requested Payment Method is not available"..... or other missing elements.

It's a pain in the ....neck, I must chase customers to ask what they actually purchased then create order manually but it is a huge amount of time spent on something we already paid for.

Must say the purchase of this module was like a "shoot in the feet" as Free version was doing exactly the same as "PRO" and same as a "PRO" had this issue.

Mainly that was the reason I bought paid version as they ensure me it will never happen again ...... lie. But at least I can "spam" their support email with hundreds of emails :P.


texts: Magento1.9 - select products with similar price from product categories

texts:
Given a $product, I need to get a random collection of 10 products belonging to the same categories of $product with a similar price - let's say +-15% the price of $product.

My idea is to get all product's $categories, then load a $cat_products collection for each category, then loop over $cat_products and check each $cat_product against my price condition and eventually add the $cat_product to an array if it matches. Then return the array.

$categoryIds = $product->getResource()->getCategoryIds($product);

foreach ($categoryIds as $categoryId) {
    $cat_products = Mage::getModel('catalog/category')->load($categoryId)
        ->getProductCollection()
        ->addAttributeToFilter('status', 1)

    foreach ($cat_products as $cat_product) {
        // check against my price conditions
    }
}

I didn't try it yet, but it should work. It looks extremely inefficient, though (also, I have a large catalog with many categories, and many categories - especially roots categories - are shared among products, so I would end up loading a few hundred thousands of products ...).

Any idea how can I get same result in a more efficient way?


texts: Overriding template default.phtml not working in Magento 2

texts:
In my custom module I have the file app/code/MyCompany/MyModule/view/frontend/layout/checkout_cart_item_renderers.xml
with the following code:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="checkout.cart.item.renderers">
            <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="MyCompany_MyModule::cart/item/default.phtml" />
            <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="simple" template="MyCompany_MyModule::cart/item/default.phtml" />
        </referenceBlock>
    </body>
</page>

But its not working

this is my core file:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="checkout_item_price_renderers"/>
    <body>
        <referenceBlock name="checkout.cart.item.renderers">
            <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="Magento_Checkout::cart/item/default.phtml">
                <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions" name="checkout.cart.item.renderers.default.actions" as="actions">
                    <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit" name="checkout.cart.item.renderers.default.actions.edit" template="Magento_Checkout::cart/item/renderer/actions/edit.phtml"/>
                    <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Remove" name="checkout.cart.item.renderers.default.actions.remove" template="Magento_Checkout::cart/item/renderer/actions/remove.phtml"/>
                </block>
            </block>
            <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="simple" template="Magento_Checkout::cart/item/default.phtml">
                <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions" name="checkout.cart.item.renderers.simple.actions" as="actions">
                    <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit" name="checkout.cart.item.renderers.simple.actions.edit" template="Magento_Checkout::cart/item/renderer/actions/edit.phtml"/>
                    <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Remove" name="checkout.cart.item.renderers.simple.actions.remove" template="Magento_Checkout::cart/item/renderer/actions/remove.phtml"/>
                </block>
            </block>
        </referenceBlock>
    </body>
</page>


texts: Can we give a privilege for the customer to send surprise gifts on a particular day to the person to whom a customer want to?


texts: Restrict access to Customer API Magento 2

texts:
My website is getting 300+ spam users for a day, On checking it seems to be from   Customer API which Magento provides.

How can I stop this users, Is there any way that I can restrict the customer API.


texts: Magento2 grunt issue occurs when running?

texts:
I am using Magento2 version CE-2.2.4 i installed npm,grunt on fresh project but when i am running command

  grunt exec:theme

then it create an error
Loading "Gruntfile.js" tasks...ERROR

  SyntaxError: Unexpected token {
  Warning: Task "exec:theme" not found. Use --force to continue.

I have tried by using force command but did not work.


texts:
In my file php:
$quoteId  = $_item->getId();
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customerObj = $objectManager->create('Mageplaza\CustomProductDesigner\Api\CustomerDataRepositoryInterface');
$customerData = $customerObj->getByQuoteItemId($quoteId);
$customerDataImage = json_decode($customerData->getCustomerData());
$previews = [];
if(is_object($customerDataImage) || is_array($customerDataImage)){
    foreach ($customerDataImage as $data) {
        if (is_object($data)) {
            $previews[] = $data->preview;
        }
    }
}
$imageDesign = '';
if(count($previews) > 0){
    $imageDesign = $previews[0];
}

In my file phtml when i write 2 line echo
<?php echo ''; ?>
<?php echo $block->getImage($block->getProductForThumbnail(), 'cart_page_product_thumbnail')->toHtml(); ?>

When i write 2 line it working but when i set check if else it not working
<?php if($imageDesign): ?>
    <?php echo ''; ?>
<?php else: ?>
    <?php echo $block->getImage($block->getProductForThumbnail(), 'cart_page_product_thumbnail')->toHtml(); ?>
<?php endif; ?>

Please help me!


texts: Magento 2: Create customer attributes programatically, without install script

texts:
How to create customer attributes magento 2 so it works in running script without install script:-

    /**
     * @var   \Magento\Eav\Setup\EavSetupFactory
     */
    protected $eavEavSetupFactory;

    public function __construct(
        ...
        \Magento\Eav\Setup\EavSetupFactory $eavEavSetupFactory,
        ...
    )
    {
        ...
        $this->eavEavSetupFactory = $eavEavSetupFactory;
        ...
    }

    public function createOrUpdateCustomerUDA($value, $input, $type)
    {
        /** @var CustomerSetup $customerSetup */
        $customerSetup = $this->eavEavSetupFactory->create(['setup' => $setup]);

        $customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
        $attributeSetId = $customerEntity->getDefaultAttributeSetId();

        /** @var $attributeSet AttributeSet */
        $attributeSet = $this->attributeSetFactory->create();
        $attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);

        $customerSetup->addAttribute(Customer::ENTITY, $value, [
            'type' => $type,
            'label' => $value,
            'input' => $input,
            'required' => false,
            'visible' => true,
            'user_defined' => true,
            'sort_order' => 1000,
            'position' => 1000,
            'system' => 0,
        ]);
        //add attribute to attribute set
        $attribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, $value)
        ->addData([
            'attribute_set_id' => $attributeSetId,
            'attribute_group_id' => $attributeGroupId,
            'used_in_forms' => ['adminhtml_customer'],
        ]);

    $attribute->save();
    }

I am using this function in my custom module to create customer attributes, but it give me below error, can please guide me how to pass the $setup in this function so it's working fine:-

Parse error: syntax error, unexpected '$setup' (T_VARIABLE), expecting ',' or ')' in Customer.php on line 540


texts:
We are continuously getting multiple spam search queries like this

大奖MG老虎机开户 Q82019309.com,

on my website. I don't understand what is this & how to stop this?
Does anyone knows anything about it?


texts: I am using 2 column left in home page. It is a cms page. In responsive i need to load as


texts: Having issues with image permissions after installing SUPEE 7405– when uploading images, they are being defaulted to 640 permissions – any thoughts?


texts: I need to show the layered navigation according to the Category in magento 2.3.5

texts:
I need to show the filters according to the categories.
Categories:

Tyre
Tube

Filters:

Brand
Thickness
Size
Model
Vehicle

Need to show the filter according to category

Tyre: Brand, Model, Vehicle.

Tube: Brand, Model, Vehicle, Size, Thickness.

How to implement the concept in layered navigation Magento 2.3.5


texts:
I would like to remove powered by Magento from the footer.

It's not in CMS blocks "footer_links".

HTML source code

 - powered by Magento (Version 1.7.0.2)


texts: Get shipping price with and without taxes

texts:
I doing a connection with a webmarketplace.

So I developed a script to export my products into a xml file. But, one of the problems I have is that I can't get the shipping amount.

I need to get the shipping price with and without taxes but anyway, firstly I just experiment the magento2 code to get the shippingAmount by country and shippingMethod.

I use the table rate shipping method, and I show you the CSV file of my table rate.

My question is, can I get the shipping amount (with and without taxes) with this kind of method. Because it return every time "null".

This, is my script code to get shipping amount

    $quoteFactory = $this->objectManager->get('\Magento\Quote\Model\QuoteFactory');
    $quote = $quoteFactory->create();
    $quote->setStore($this->currentStore);
    $quote->setInventoryProcessed(false);

    $shipModel = $this->objectManager->get('Magento\Shipping\Model\Shipping');
    $quote->addProduct($product, 1);
    $address = $quote->getShippingAddress();
    $address->setCountryId('US')
        ->setCity('')
        ->setPostcode('*')
        ->setRegionId('')
        ->setRegion('')
        ->setShippingMethod(current($carriers))
        ->setCollectShippingrates(true)
        ->collectShippingRates();

    $quote->save();

    die(json_encode($address->getShippingAmount())); //debug

And now, my table rate csv file.

Country,Region/State,"Zip/Postal Code","Order Subtotal (and above)","Shipping Price"

USA, * ,*,0.0000,15.0000

USA, * ,*,50.0000,10.0000

USA, * ,*,100.0000,5.0000

USA,AK,*,0.0000,20.0000

USA,AK,*,50.0000,15.0000

USA,AK,*,100.0000,10.0000

USA,HI,*,0.0000,20.0000

USA,HI,*,50.0000,15.0000

USA,HI,*,100.0000,10.0000

Thanks.

EDIT (About product and carrier)

$carriers = array('tablerate');

$store = $this->storeManager->getStore($store_id);

$products = $this->productCollection
                            ->addStoreFilter($store)
                            ->addAttributeToSelect('*')
                            ->load()

foreach ($products as $product) {

    $product->setStoreId($store->getId())->load($product->getId());

    // AND HERE THE CODE ABOVE

}


texts: How to implement per page meta description and keywords in Magento?

texts: I'm trying to change meta description and keywords (I know keywords aren't useful) in Magento CMS pages, but the site is still outputting the sitewide default values. What am I missing?


texts: Ajax update of Proceed to checkout button if product is out of stock

texts:
Now add and remove products are taking place via ajax. But when the product is out of stock I want to remove the proceed to checkout button via ajax.

Once that out of stock product has been removed from cart, proceed to checkout button should be displayed again.

public function deleteAction()
    {
        if ($this->getRequest()->isXmlHttpRequest()) {
            $itemId = (int) $this->getRequest()->getParam('id');
            $msg = '';
            if ($itemId) {
                try {
                    $this->_getCart()->removeItem($itemId)
                      ->save();
                    $msg = $this->__('Item was removed successfully.');
                } catch (Exception $e) {
                    $msg = $this->__('Cannot remove the item.');
                    // $this->_getSession()->addError($this->__('Cannot remove the item.'));
                    Mage::logException($e);
                }
            }
            //$this->_redirectReferer(Mage::getUrl('*/*'));
            $layout = $this->getLayout();
            $update = $layout->getUpdate();

            $update->load('born_checkout_cartheader');
            $layout->generateXml();
            $layout->generateBlocks();
            $minicartHtml = $layout->getOutput();
            $update->setCacheId(null);
            $update->load('born_checkout_cart');
            $layout->generateXml();
            $layout->generateBlocks();
            $cartHtml = $layout->getOutput();
            $result = array('minicartHtml' => $minicartHtml,'cartHtml' => $cartHtml,'msg' => $msg);
            $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
        } else {
            parent::deleteAction();
        }
    }


texts: Change Custom status(Ready to ship) using rest api in magento2.1.12

texts: I will create one custom order-status (Ready to Ship) in Magento-2.1.12.How to change this status using rest API in magento.2.1.12?Please suggest me.Thanks in advance.


texts:
I create cms block and add call in category it show in main cat but not in the sub cat of this main category

<?php
$currentCateId = Mage::registry('current_category')->getId();
///if($currentCateId == 3){
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('aed-left-banner-new')->toHtml();
//}
?>
<?php endif; ?>


texts: How to resolve wamp issue with Magento 2.2.7

texts: I have installed wamp 3.0.8 for 32 bit Windows 10 OS in my laptop. And I have downloaded Magento 2.2.7. While hitting http://localhost:8080/magento I am getting this error. Please help me to solve the issue or give guidance to get magento in my Laptop with WAMP.


texts: Magento 2 | Troubles changing CSS class attribute value.

texts:
I am struggling changing a CSS class attribute value of "float :left" to "float: none" for ages now.
I have a class in here:

I tired everything... I found the class in http\app\design\frontend\Venustheme\cricket\web\css\source\_widgets.less:
.owl-carousel{
    width: auto !important;
    margin-left: -(@grid-gutter-width/2)!important;
    margin-right: -(@grid-gutter-width/2)!important;
    .owl-item{
        padding-left: @grid-gutter-width/2!important;
        padding-right: @grid-gutter-width/2!important;
        float: left;
        .translate3d(0px, 0px, 0px);
    }
    .owl-wrapper {
        .translate3d(0px, 0px, 0px);
        float:left;
    }
    .owl-stage{float: left;}
    .owl-nav.disabled{display: none;}
}

Changed it to float: none; and did following:

Flushed Static files Cache
Flushed Javascript / CSS Cache
Flushed Catalog Images Cache
Flushed Magento Cache
Flushed Storage Cache
Flushed Cache using Magerun
Purged Redis Cache
Purged Varnish Cache
Re-deployed static content
Removed files from rm -rf var/cache/ var/generation/ var/page_cache/ var/view_preprocessed/ and redeployed again.

Nothing... It's driving me insane now. Anyone has any ideas?


texts: Magento 2 Error filtering template: Warning: filesize ()

texts: Error filtering template: Warning: filesize(): stat failed for http://localhost/jaipurbkp/pub/media/catalog/product/s/c/screen_shot_2020-10-03_at_2.37.35_pm.png in C:\wamp64\www\jdrbkp\vendor\magento\framework\Image\Adapter\Gd2.php on line 63


texts: How to get current customer id in helper class of module in magento2

texts:
I want to get current customer id in Helper class of  module in magento2.

How to get using helper in Magento 2.

Can anyone help me?


texts: Old order email send to admin user Magento 1.9?

texts:
If it is possible to send the old order mail again send to the admin user.

order mail functionality is now working correctly but I have sent old order mail again.

So please anyone tell how to do it in programmatically.


texts: Magento 2: Allow Arabic string in "letters-only" validation

texts:
I'am working on the Magento store that have Arabic language store and English language store.

I have added the "letters-only" validation on firstName input field on registration page and when I check this validation on English version its working fine, but in Arabic version validation not working.

"Letters only" validation not accept Arabic string.

I'm trying below rules one by one but no luck:-

//return this.optional(element) || !/^[0-9_]+$/i.test(value);
return this.optional(element) || /^[\p{Arabic}a-zA-Z\- .ـ]+$/i.test(value);
return this.optional(element) || /^[a-zA-Z\-+,()/'\s\p{Arabic}]+$/i.test(value);
return this.optional(element) || /^[\s\p{Arabic}]+$/i.test(value);

Please suggest any solution to get rid this issue So in Arabic version user can add their information.

Thanks!!!


texts:
I have 4 different themes for 4 different website on the same Magento system. One of the themes has a particular folder on code/local/Magentothem/LayeredNavigationajax whic contents for example the filter.phtml file for the layered navigation of that theme.

The problem is that the rest of the themes are taking this file - filter.phtml on code/local/Magentothem/LayeredNavigation - by default to display the filters, instead of taking the filter.phtml file on their themes.

Any suggestions on how can I fix that? I don't really know how to debug this and check how on theme can take this file from another theme.

Thanks in advance for any help!


texts: INSERT INTO “search_tmp…” very slow with custom attributes

texts:
l've a problem with filter.
I've 3 custom filter ( pietre , materiali , inspiration );
When select Category , Pietre and Materiali , query that populates search_tmp finish at least in 1 minute.
Query processes 54403700 records
INSERT INTO `avm_search_tmp_5f171481ecd303_40667492`  SELECT `main_select`.`entity_id`, SUM(score) AS `relevance`  FROM (SELECT DISTINCT  `search_index`.`entity_id`, (((0) + (0) + (0) + (0)) * 1) AS `score`  FROM `avm_catalog_product_index_eav` AS `search_index` INNER JOIN `avm_catalog_product_index_eav` AS `materiale_filter` ON `search_index`.`entity_id` = `materiale_filter`.`entity_id` AND `materiale_filter`.`attribute_id` = 152 AND `materiale_filter`.`store_id` = 6 INNER JOIN `avm_catalog_product_index_eav` AS `pietre_filter` ON `search_index`.`entity_id` = `pietre_filter`.`entity_id` AND `pietre_filter`.`attribute_id` = 150 AND `pietre_filter`.`store_id` = 6 INNER JOIN `avm_cataloginventory_stock_status` AS `stock_index` ON stock_index.product_id = search_index.entity_id AND `stock_index`.`website_id` = 0 AND `stock_index`.`stock_id` = 1 INNER JOIN `avm_cataloginventory_stock_status` AS `sub_products_stock_index` ON sub_products_stock_index.product_id = search_index.source_id AND `sub_products_stock_index`.`website_id` = 0 AND `sub_products_stock_index`.`stock_id` = 1 INNER JOIN `avm_catalog_product_index_eav` AS `visibility_filter` ON search_index.entity_id = visibility_filter.entity_id AND `visibility_filter`.`attribute_id` = 99 AND `visibility_filter`.`value` in ('2', '4') AND `visibility_filter`.`store_id` = '6' INNER JOIN `avm_catalog_category_product_index_store6` AS `category_ids_index` ON search_index.entity_id = category_ids_index.product_id AND category_ids_index.store_id = '6' WHERE (search_index.store_id = '6') AND (category_ids_index.category_id = 5) AND (materiale_filter.value = '6168') AND (pietre_filter.value = '5770')) AS `main_select` GROUP BY `entity_id` ORDER BY `relevance` DESC, `entity_id` DESC LIMIT 10000
I need to remove:

INNER JOIN avm_cataloginventory_stock_status AS stock_index
INNER JOIN avm_cataloginventory_stock_status AS sub_products_stock_index

Where can I do this modify?
Or other solutions for to decrease the proccess time.
Thank you.


texts:
I've spent way too many hours digging through SO and the rest of the net looking for a solution to this, and after trying just about every suggestion I'm still at a loss.

The issue is we need dynamic content in the top bar. Currently this looks like...
Home | Categories | <LoggedInBlock> <LoggedOutBlock> <EveryoneBlock>
...where the three blocks are Static Blocks editable in the admin, and the LoggedIn and LoggedOut blocks are added in the layout via <customer_logged_in/out>.

Ultimately the goal is simply to have top menu links editable in the admin, and certain links hidden if logged in or out (whereas some links always appear). This works fine until Full Page Caching is enabled, at which point either the logged in version or logged out version get cached for all users to see regardless of their status.

Most recommendations revolve around block values like cache_lifetime/cache_tags/etc, but messing with any of these at the layout or block level seems irrelevant in regards to the Full Page Cache. The Catalognavigation FPC container isn't comparing cache ids and does it's job before the layout loads. I can only imagine Enterprise_PageCache_Model_Container_Catalognavigation needs to be overwritten to have user status somehow worked into it, but I can't say I know how to mess with these crazy caching functions.

I've considered giving up on hole punching the top menu althg and just removing the default one entirely, setting up a simple core/template block to build the menu in. Only issue with this is the categories menu in the Topmenu_Renderer block is intricately weaved into the topmenu code, to the point that trying to separate it seems impossible on the already expired time budget.

Magento EE 1.14.1


texts: Change the customer group according to the custom field created in the magento checkout page

texts:
I have created a custom field in magento onepage checkout page. When a user is filling this field his customer group should set to group 1 and if the field is left blank his customer group should be group 2.

My main problems

1) How to set the customer group value programatically when user is registering thru checkout page

2) How to relate my custom field value and customer group value in checkout process.

Thanks in advance.


texts: Set cookie path and cookie domain in Magento for multi store

texts:
I've seen a ton of posts out there regarding issue, but no resolution yet.

Trying to set a cookie path and cookie domain for a multi-store Magento setup for the 2 stores I have in Magento (ver. 1.9.2.4).

mystore.com
retail.mystore.com

I've set main store (mystore.com) config to

Cookie Path: /
Cookie Domain: mystore.com

And I've set retail store (retail.mystore.com) config to

Cookie Path: /
Cookie Domain: retail.mystore.com

Need to set a different cookie for each. Any idea what I'm missing?

UPDATED ANSWER
I resolved by setting main store

Cookie Path: /
Cookie Domain: mystore.com

and retail store as

Cookie Path: /
Cookie Domain: .mystore.com


texts: Include a global function accessible from any php/phtml file

texts:
I have a breakpoint function I use for debugging in all my php development projects and which I want to use with Magento 2. It's a simple function and the details of it are irrelevant - it basically receives a variable as input and outputs the content of the variable in a nicely formatted way.

I'd like to include this as a 'global' function that I can call from any php or phtml file.

All the solutions I've found so far are either old (or at least pre magento 2)  and don't seem to work, or they involve several files in several directories, registering modules etc. etc...

I'm not looking for other debugging methods, I'm sure M2 has loads of wonderfully complex and arcane ways to do this simple thing. The question is just about including a global function.


texts: Redirect in observer on server not working

texts:
I have created an observer model to redirect the checkout page after successful order to another form. The Redirection code I have applied is working on my localhost but when I tried the same code on server it is giving the error :

 a:5:{i:0;s:140:"Cannot send headers; headers already sent in /home1/remarkc4/public_html/restauranttechpros/app/code/local/Mage/Cms/Block/Eblock.php, line 2";i:1;s:2101:"#0 /home1/remarkc4/public_html/restauranttechpros/lib/Zend/Controller/Response/Abstract.php(148): Zend_Controller_Response_Abstract->canSendHeaders(true)
 #1 /home1/remarkc4/public_html/restauranttechpros/app/code/core/Mage/Core/Controller/Response/Http.php(106): Zend_Controller_Response_Abstract->setRedirect('http://remarkab...', 302)
 #2 /home1/remarkc4/public_html/restauranttechpros/app/code/local/Dataman/OrderInfo/Model/Observer.php(24): Mage_Core_Controller_Response_Http->setRedirect('http://remarkab...')
 #3 /home1/remarkc4/public_html/restauranttechpros/app/code/core/Mage/Core/Model/App.php(1338): Dataman_OrderInfo_Model_Observer->getSuccessOrderInfo(Object(Varien_Event_Observer))
 #4 /home1/remarkc4/public_html/restauranttechpros/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Dataman_OrderInfo_Model_Observer), 'getSuccessOrder...', Object(Varien_Event_Observer))
 #5 /home1/remarkc4/public_html/restauranttechpros/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('checkout_onepag...', Array)
 #6 /home1/remarkc4/public_html/restauranttechpros/app/code/core/Mage/Checkout/controllers/OnepageController.php(294): Mage::dispatchEvent('checkout_onepag...', Array)
 #7 /home1/remarkc4/public_html/restauranttechpros/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Checkout_OnepageController->successAction()
 #8 /home1/remarkc4/public_html/restauranttechpros/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('success')
 #9 /home1/remarkc4/public_html/restauranttechpros/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
 #10 /home1/remarkc4/public_html/restauranttechpros/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
 #11 /home1/remarkc4/public_html/restauranttechpros/app/Mage.php(683): Mage_Core_Model_App->run(Array)
 #12 /home1/remarkc4/public_html/restauranttechpros/index.php(87): Mage::run('', 'store')
 #13 {main}";s:3:"url";s:55:"/restauranttechpros/index.php/checkout/onepage/success/";s:11:"script_name";s:29:"/restauranttechpros/index.php";s:4:"skin";s:7:"default";}

Here is my code of observer:

 <?php
 class Dataman_OrderInfo_Model_Observer
 {
 public function getSuccessOrderInfo(Varien_Event_Observer $observer)
 {
    $orderIds = $observer->getEvent()->getOrderIds();

    if (!is_array($orderIds) || (!array_key_exists(0, $orderIds)))
    {
        return;
    }

    $order = Mage::getModel('sales/order')->load($orderIds[0]);
    $items = $order->getAllItems();
    $itemcount=count($items);
    $ids=array();
    foreach ($items as $itemId => $item)
    {
        $ids[]=$item->getProductId();
    }

    if(in_array('1207',$ids))
    {
        Mage::app()->getResponse()->setRedirect(Mage::getUrl('customerticket'))->sendResponse();
        exit();
    }

    return true;
 }
 }
 ?>

Please help me what am I doing wrong.

Thanks


texts:
I have installed a third party search mod and now want to remove the native "advanced search" from the web site as well as all reference on the front end.

Have tried the "How to disable Advanced Search?" but that is just a redirect solution and leaves the front end button in the template.
How do i do this without endangering future upgrades


texts: How to include a captcha inside the share wishlist form in magento 1.9

texts:
I am trying to add the captcha core/text_list block to the wishlist_index_share handle in the wishlist.xml layout file but the block is not displayed.

Here is my code:

<wishlist_index_share translate="label">
   Customer My Account Wishlist Sharing Form

   <update handle="customer_account" />
   <reference name="my.account.wrapper">
      <block type="wishlist/customer_sharing" name="wishlist.sharing" template="wishlist/sharing.phtml"/>
      <block type="core/text_list" name="form.additional.info">
         <block type="captcha/captcha" name="captcha">
            <reference name="head">
               <action method="addJs"><file>mage/captcha.js</file></action>
            </reference>
            <action method="setFormId"><formId>user_create</formId></action>
            <action method="setImgWidth"><width>230</width></action>
            <action method="setImgHeight"><width>50</width></action>
         </block>
      </block>
   </reference>
   <reference name="right">
      <action method="unsetChild">
         <name>wishlist_customer_sidebar</name>
      </action>
   </reference>
</wishlist_index_share>

I also added to Mage/captcha/etc config.xml to the frontend areas the following so the form would show up in the System -> configuration -> customer configuration -> captcha section form list:

<wishlist_index_share>
   Share Wishlist
</wishlist_index_share>

Also in the same file, in customer -> captcha:

<always_for>
   <user_create>1</user_create>
   <user_forgotpassword>1</user_forgotpassword>
   <guest_checkout>1</guest_checkout>
   <register_during_checkout>1</register_during_checkout>
   <wishlist_index_share>1</wishlist_index_share>
</always_for>

In the wishlist.phtml file I call the captcha block with the following line:

<?php echo $this->getChildHtml('form.additional.info'); ?>

Any ideas of what I need to add to the layout file?
Thank you so much


texts: What is the process to create an even exchange?

texts:
I'm new to Magento and I need some help.

I'm not sure how to create an even exchange without charging the customers credit card again.  Let's say the customer purchased item X in a small but wants a medium. Normally, I'd create a new order for the medium and charge the credit card.  Then, once we receive the small in the warehouse a credit would be issued to the card.

My problem is we do not save the credit card information in Magento. This requires us to contact the customer for their credit card number when we place the new order.  Is there an easier way to do this?

I have the same problem if we make a mistake in shipping.  The customer ordered a medium but we send a large.  I'll issues a call tag for the large and send out the correct product but again I need to get the customer credit card.

thanks


texts:
I'm learning the Magento form generation feature and I have an question related to system.xml file. Here's the code example:

    <days translate="label">
      Days
      <frontend_type>multiselect</frontend_type>
      <source_model>adminhtml/system_config_source_locale_weekdays</source_model>
      <sort_order>10</sort_order>
      <show_in_default>1</show_in_default>
      <show_in_website>1</show_in_website>
      <show_in_store>1</show_in_store>
      <comment>Days</comment>
    </days>
    <sunday translate="label">
      Sunday
      <frontend_type>multiselect</frontend_type>
      <source_model>xxx_xxx_Model_System_Config_Source_Hours</source_model>
      <sort_order>100</sort_order>
      <show_in_default>1</show_in_default>
      <show_in_website>1</show_in_website>
      <show_in_store>1</show_in_store>
      <comment>Hours in Sunday</comment>
      <depends>
        <days>0</days>
      </depends>
    </sunday>
    <monday translate="label">
      Monday
      <frontend_type>multiselect</frontend_type>
      <source_model>xxx_xxx_Model_System_Config_Source_Hours</source_model>
      <sort_order>110</sort_order>
      <show_in_default>1</show_in_default>
      <show_in_website>1</show_in_website>
      <show_in_store>1</show_in_store>
      <comment>Hours in Monday</comment>
      <depends>
        <days>1</days>
      </depends>
    </monday>

The source model returns list of hours - from 0 to 23.

Why when I select Sunday and Monday only Sunday dependency appears, but when I select only Monday, the Monday dependency appears as it should, but how to get working multiple dependences with multiselect field?


texts: Magento2: How to Import and export CSV file from admin panel?

texts:
How to import and export custom CSV file from admin panel demo?

I want to add the custom shipping price state and zip code wise in the database from the admin panel. Then I will apply extra the shipping charges on the cart page.

My Magento v2.0.17


texts: I need to remove /en from url in magento 2

texts:
When I click on category from homepage I found my URL format like this example.com/en/category.

I need to remove the /en from URL.


texts:
We got a message from one of our customer to say they got this error message on our Magento 1.9.3 site when they tried to go to the checkout:

  Missing class: Class 'bootstrap_mage' is missing

Any idea what could be causing this?  I'm trying to get more detail from the customer but this is what I have for now.  We have had about 25 successful orders since this customer reported the issue.  Also I've checked to make sure both of these files exist on our production environment and they do:

app/bootstrap.php

lib/Zend/Application/Bootstrap/Bootstrap.php

Anyone have any ideas on what this could be?


texts:
Magento's Tax Rate import utility creates a new rate (a duplicate) instead of updating existing rate. We need it to update existing rates.

Has anyone found a way of mass updating tax rates?


texts:
I am trying to implementing cron job for my module but getting error in CLI.

I am using windows operating system.

here is crontab.xml

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="customdesignsubcategories_cron">
    <job name="uploadFile_deletion" instance="vender\module\Cron\UploadFileDeletion" method="execute">
        <schedule>1/2 * * * *</schedule>
    </job>
</group>

here is UploadFileDeletion.php

<?php
namespace vender\module\Cron

class UploadFileDeletion
{
protected $_logger;
public function __construct(\Psr\Log\LoggerInterface $logger)
{
    $this->_logger = $logger;
}
public function execute()
{
    $this->_logger->debug('Cron run successfully');
    return $this;
}
}

following commands i fire in CLI

php bin/magento cron:run --group="customdesignsubcategories_cron"

Error =>

  [Magento\Framework\Exception\LocalizedException]   Invalid Document
  Element 'job': The attribute 'instance' is required but missing.
  Line: 4

  Element 'job': The attribute 'method' is required but missing.
  Line: 4

  Element 'schedule': Element content is not allowed, because the type
  definition is simple.   Line: 5

  Element 'schedule': [facet 'minLength'] The value has a length of
  '0'; this underruns the allowed minimum length of '5'.   Line: 5

  Element 'schedule': '' is not a valid value of the list type
  'scheduleDeclaration'.   Line: 5

  Element 'run': This element is not expected. Expected is (
  config_path ).   Line: 8

  cron:run [--group GROUP] [--bootstrap BOOTSTRAP]


texts:
I need reference questions about Magento 2 to get the Magento 2 certification.

Is there a list of questions for the Magento 2 exam?


texts: Magento set product sku as prefix of order id

texts:
I know that, Magento has it's own way of generating order ids for orders placed through it.

Instead of the default way, I want to set product sku as the prefix for order-ids and keep order increment id as it is.

Is there any way to achieve this in Magento?


texts: Show product of a category in a custom page

texts:
I create a category with some product. Also create a custom layout for my page that I add new cms page with this layout that I created. I need to have this page with my layout because I want to add some php code just for this page. I redirect category to this page but my problem is here that products that I added to this category doesn't show in page.

Now I want to know how can I show products in this page?

Steps that I created my custom layout:

1.) I create a phtml file with 2columns-left.phtml layout and it's name is renewpage.phtml and it's address is: app/design/frontend/default/celebrity/template/page.

2.) I added it's config.xml in app/code/local/Renew/Page/etc/config.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <Renew_page>
            <version>0.1.0</version>
        </Renew_page>
    </modules>
    <global>
        <page>
            <layouts>
                <renewpage translate="label">
                    <label>Renew_page</label>
                    <template>page/renewpage.phtml</template>
                    <layout_handle>Renew_page</layout_handle>
                </renewpage>
                <!-- add more layouts here -->
            </layouts>
        </page>
    </global>
</config>

3.) And add Renew_page.xml in app/etc/modules/Renew_page.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <Renew_page>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Page />
            </depends>
        </Renew_page>
    </modules>
</config>


texts: Magento 2 Class Magento\ConfigurableProduct\Model\Product\VariationHandler does not exist

texts:
I am trying to add configurable product in Magento 2 and getting this error

Class Magento\ConfigurableProduct\Model\Product\VariationHandler does not exist {"exception":"[object] (ReflectionException(code: 0): Class Magento\\ConfigurableProduct\\Model\\Product\\VariationHandler does not exist at /home/hqbelectronic/public_html/vendor/magento/framework/Code/Reader/ClassReader.php:37, ReflectionException(code: 0): Class Magento\\ConfigurableProduct\\Model\\Product\\VariationHandler does not exist at /home/hqbelectronic/public_html/vendor/magento/framework/Code/Reader/ClassReader.php:29, Exception(code: 0): Warning: Narrowing occurred during type inference. Please file a bug report on bugs.php.net in /home/hqbelectronic/public_html/vendor/composer/ClassLoader.php on line 444 at /home/hqbelectronic/public_html/vendor/magento/framework/App/ErrorHandler.php:61)"} []

However i have checked vendor/magento/module-configurable-product/Model/Product/VariationHandler.php file is there.

I have tried removing var/generation var/cache var/page_cache var/di

Also Magento 2 is in developer mode.


texts: Magento 2 messages are not displayed on homepage

texts:
I am working on a Magento 2.1.2 project, theme Porto. I installed the MageMonkey extension for Mailchimp integration.

I strugle with displaying the messages of successful / unsuccessful subscription to newsletter on the homepage. On local, everything works as intended but on preprod server the afterRenderResult() method of Magento\Theme\Controller\Result\MessagePlugin is not called, so no mage-messages cookie is set.

On preprod if I visit another page, the messages are displayed.

Has anyone had this problem ?

I even have deployed a preprod database on local thinking that the problem  is in the database.

Maybe it is a caching problem ?


texts: How to override layout file, which is already override by other theme - layout\override\base\somel_ayout.xml

texts:
How to override layout file, which is already override by other theme.

For example, we have existing theme.

app\design\frontend\<Vendor>\<themeone>\Module_Vendor\layout\override\base\somel_ayout.xml

How to override somel_ayout.xml file in my current theme.

Help would be appreciated.


texts:
I can not seem to remove a specific product image in Magento. When I select the remove checkbox and click save and continue, the image is still there. Also no error message is shown.

I thought it might have to do with permissions, but I checked and in the media folder these are all 0777.

I have also seen that there are differences between the number of images in each storefront. The German store has 5, which does not include inane number 6 which I want to remove. The Dutch store has six, which does contain image nr six which I want to remove.


texts: how to join three tables on every time when model load

texts:
I want to join three tables on every time when model load (for example on edit from page, on grid page in admin and detail page in front-end etc... ) in my custom module. can you please let me know where is best place to code for this (in model class, in resource class or collection class) and what function I should use for joining?

please help me to fix this.

Edited:

<?xml version="1.0"?>
<config>
    <modules>
        <Mynamespace_Mymodule>
            <version>1.0.4</version>
        </Mynamespace_Mymodule>
    </modules>
    <global>
        <resources>
            <mynamespace_mymodule_setup>
                <setup>
                    <module>Mynamespace_Mymodule</module>
                    <class>Mynamespace_Mymodule_Model_Resource_Setup</class>
                </setup>
            </mynamespace_mymodule_setup>
        </resources>
        <blocks>
            <mynamespace_mymodule>
                <class>Mynamespace_Mymodule_Block</class>
            </mynamespace_mymodule>
        </blocks>
        <helpers>
            <mynamespace_mymodule>
                <class>Mynamespace_Mymodule_Helper</class>
            </mynamespace_mymodule>
        </helpers>
        <models>
            <mynamespace_mymodule>
                <class>Mynamespace_Mymodule_Model</class>
                <resourceModel>mynamespace_mymodule_resource</resourceModel>
            </mynamespace_mymodule>
            <mynamespace_mymodule_resource>
                <class>Mynamespace_Mymodule_Model_Resource</class>
                <entities>
                    <table1>

mynamespace_mymodule_table1

                    </table1>
                    <table2>

mynamespace_mymodule_table2

                    </table2>
                    <table3>

mynamespace_mymodule_table3

                    </table3>
                </entities>
            </mynamespace_mymodule_resource>
        </models>
    </global>
    <adminhtml>
        <layout>
            <updates>
                <mynamespace_mymodule>
                    <file>mynamespace_mymodule.xml</file>
                </mynamespace_mymodule>
            </updates>
        </layout>
    </adminhtml>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <Mynamespace_Mymodule before="Mage_Adminhtml">Mynamespace_Mymodule_Adminhtml</Mynamespace_Mymodule>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>

Thanks in advance!


texts: Magento 2 - How to get category name and category tree for product or for category id?

texts:
Magento 2.2.7

I have to output category name and "tree" or path for product.
For instance if my product is in category Lg775 my output should be:
Hardware/Motherboards/Intel/Lg775

so far I have this code that gives me category ID:

 //Load the product categories
 $categories = $product_data->getCategoryIds();
 //Select the last category in the list
 $categoryId = end($categories);

Thank you all Magento experts for all the help so far! I really appreciate it :)

UPDATE - Solved

So I used the answer I checked however I had to modify the code so here is my code how to get full category path for "categoryID"

<?php

namespace Vendor\Module\Helper;

class CategoryTree {

    /**
     * @var \Magento\Store\Model\StoreManagerInterface
     */
    private $storeManager;

    /**
     * @var \Magento\Catalog\Api\CategoryRepositoryInterface
     */
    private $categoryRepository;

    /**
     * @var \Magento\Catalog\Model\ResourceModel\Category\Tree
     */
    private $tree;

    public function __construct(
        \Magento\Catalog\Api\CategoryRepositoryInterface $categoryRepository,
        \Magento\Catalog\Model\ResourceModel\Category\Tree $tree,
        \Magento\Store\Model\StoreManagerInterface $storeManager) {
       $this->tree = $tree;
       $this->categoryRepository = $categoryRepository;
       $this->storeManager = $storeManager;
    } // end of function __construct

    public function getTreeByCategoryId($categoryId)
    {
        $storeId = $this->storeManager->getStore()->getId();
        $category = $this->categoryRepository->get($categoryId, $storeId);
        $categoryTree = $this->tree->setStoreId($storeId)->loadBreadcrumbsArray($category->getPath());

        $categoryTreepath = array();
        foreach($categoryTree as $eachCategory){
            echo $eachCategory['name'];
            $categoryTreepath[] = $eachCategory['name'];
        }
      $categoryTree = implode(" &gt; ",$categoryTreepath);
      return $categoryTree;
    } // end of function getTreeByCategoryId

} // end of class

later I called that class like this:

      $categoryObject=\Magento\Framework\App\ObjectManager::getInstance();
      $category=$categoryObject->create('Vendor\Module\Helper\CategoryTree');
      $categoryTreepath=$category->getTreeByCategoryId($categoryId);
      var_dump($categoryTreepath);

The result was just what I needed :) Thank you all!


texts: Magento 2.3.1 clear carts and start over

texts:
I want to clear all shopping carts from database and start from scratch. But I don't want to create problems in database for my customer accounts or store orders.
I just want to remove all carts which are abandoned.

I am thinking to use this queries in database:

SET FOREIGN_KEY_CHECKS=0;

TRUNCATE TABLE `quote`;
TRUNCATE TABLE `quote_address`;
TRUNCATE TABLE `quote_address_item`;
TRUNCATE TABLE `quote_id_mask`;
TRUNCATE TABLE `quote_item`;
TRUNCATE TABLE `quote_item_option`;
TRUNCATE TABLE `quote_payment`;
TRUNCATE TABLE `quote_shipping_rate`;

SET FOREIGN_KEY_CHECKS=1;

Will these do my job? Or I break everything?


texts:
I'm trying to install a theme to a fresh installation of Magento (literally the first thing done after initial install).

Theme:
http://connect20.magentocommerce.com/community/pagayo_pt002
(this is the exact link copied into the "extension key" box)

I am getting this error:
community/pagayo_pt002: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure

I also get the same error no matter what extension i try to install.

Please help. I really need this to work!!

Thanks.


texts: php extension mcrypt/curl must be loaded

texts:
I was following a tutorial online about installing magento on ubuntu, but when I refresh the page at step 8/9/10(correct writable permissions on files) I get 2 errors: php extension mcrypt must be loaded and php extension curl must be loaded
I've found some answers online about how to fix it but I cant seem to find any answer that helps me. I'm running Ubuntu 13, apache2 and magento 1.9.0.1. What should I do to fix this?


texts: Magento2: how to update image in media type attribute

texts:
I need to update Product Images programmatically. I have created custom media type attribute like:

Image1, Image2, Image3

I need to delete Image2 from MediaGalleryEntries and reassign Image3 to Image2.

Magento\Catalog\Model\Product\Gallery\GalleryManagement

I am checking GalleryManagement class as well but not able to getting, how to swap images and update ?


texts: Unable to open magento session and report files

texts:
I have Magento CE 1.9.2.0, my var/report and var/session files has become so big I am unable to open them. My server crashes each time I try to open.

How do I set Cron to delete old files that are not necessary for both folders. I have got got php.ini in my root folder, below is the information.

; This file is for CGI/FastCGI installations.
; Try copying it to php5.ini, if it doesn't work

; adjust memory limit

memory_limit = 64M

max_execution_time = 18000

; disable magic quotes for php request vars

magic_quotes_gpc = off

; disable automatic session start
; before autoload was initialized

flag session.auto_start = off

; enable resulting html compression

zlib.output_compression = on

; disable user agent verification to not break multiple image upload

suhosin.session.cryptua = off

; turn off compatibility with PHP4 when dealing with objects

zend.ze1_compatibility_mode = off

; PHP for some reason ignores this setting in system php.ini
; and disables mcrypt if this line is missing in local php.ini

extension=mcrypt.so

; Disable PHP errors, notices and warnings output in production mode to prevent exposing sensitive information.

display_errors = Off
php_value memory_limit 128M

Any advice will be much appreciated.


texts: Failed to load css and js script after successful installation

texts:
I have got a hard time dealing with the Magento installation. The installation is successful but the page is showing just plain text with all css and javascript failed to load.

I am using subdomain of shop.domain.com to point to a subfolder in my root. My root domain.com is a Wordpress project and i want the shop.domain.com using the magento.

After reading through many tutorial online and so much time spent, i still fail to get this resolve. One of the answer from this link - CSS and Javascript files are not loading after Magento 2 installation

step 1. php bin/magento setup:static-content:deploy
step 2. php bin/magento indexer:reindex
step 3. make sure apache "rewrite_module" is enable and then restart the server
step 4. delete cache folder under var/cache

I spoke to my hosting server support, and the shocking reply i got is:
We could not allow you to use the options. Our security policy on shared server wont allow you to do so. So I am suggesting you to upgrade your hosting to cloud VPS or Dedicated server. We are no longer encouraging the magento 2 on shared servers. We will remove the that version from softaculas soon. That version of  application require so many functions which we are blocking in shared servers due to security risk.

Do i need a dedicated server to run Magento? Could anyone help on my problem?

FYI, the hosting Server support has helped to remove the following 2 lines in the root .htaccess file. If that 2 lines are not removed, it will cast the error "Internal Server Error" on page load before Magento installation.

#

enable rewrites

Options +FollowSymLinks

##   RewriteEngine on

#


texts: Create virtual product with custom options and dynamic price programmatically

texts: How to create a virtual product programmatically and add custom option to it? And how to set the product price dynamic ?


texts:
I want to add my custom library file in my custom extension.

How we integrate library on magento-2 custom extension?


texts: Reindex the products after updating the products

texts: I have a updated or added a products through the cron file. Every time after updating the products i need to reindex the products, Is there any way to reindex products after cron run.


texts: Events and observers; what is being cached?

texts:
I am using Cloudflare to retrieve the Geo IP of a user.

When using this in pub/index.php it always works and I am able to set the correct store view based on the header Cloudflare is passing.

However, this doesn't seem good practice (and it is ignored in my repository too). So that's why I'm trying to do it correctly via this observer:

<event name="controller_action_predispatch">
    <observer name="elephant_cfparent_controller_redirect" instance="Elephant\CFParent\Model\ObserverGeoIP" />
</event>

However, this is being cached, resulting in an incorrect store view for a user in another country. Is anyone aware on how I can do this without cache? Or am I using the wrong event name for example?

Cache is normal Magento FPC (no Varnish) and I'm on Magento 2.0.7.


texts:
I'm trying to improve my pagespeed score and the biggest holdup I have now is the Icon fonts not being preloaded, as my theme is based on the blank one the Icons are declared and imported through the css instead of a header link I believe?
How can this be changed so they can be preloaded?


texts: Lost product image roles when save product by program

texts:
When I save Product in shell(foreach loop) like below, the product image roles will disappear!

$product = $this->productRepository->getById($data['product_id']);
$this->productRepository->save($product);

I google it and found it is a official bug and not fixed yet(include version 2.1, 2.2, 2.3). The official github issue link is Product image roles randomly disappear. The codes below will lost all image roles too.

$store = $this->storeManager->getStore(0);
$this->storeManager->setCurrentStore($store);
$product = $this->productRepository->getById($data['product_id'], true, $store->getId());
$this->productRepository->save($product);

It seems as long as we use $this->productRepository->save($product);, it will lost product image roles.

How to temporarily solve the problem before the official fix the bug?


texts:
Is it possible to reset the Salable Quantity? It looks like our Stock and Salable Quantity is going the wrong way, they show to much difference. It can because of we removed all the test orders...

So we need to reset it so we can make a fresh start.


texts:
I am trying to do the same thing in Magento CE 1.9.1.0 . Basically I want to edit the related products block to show all products that have the same value for a specific attribute. Basically I have an attribute called family and when you view product abc which belongs to the attribute family 'Pepsi' I want to display all other products that have a value for the family attribute of 'pepsi'

So I am altering the file app/design/frontend/MY_THEME/default/template/catalog/product/list/related.phtml

The first thing I do in this file is get the value of the family attribute by doing the below

         //get the name of the family that the product being viewed is a part of
         $itemcollectionname = Mage::getModel('catalog/product')->load($_product->getId())->getAttributeText('family');

I then tried using the code in the above post like so

         $rcollection = Mage::getModel('catalog/product')->getCollection()
         ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes()) //add some attribtues to select
         ->addAttributeToFilter('family', array('eq'=>$itemcollectionname);//filter products with the same family
         Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($rcollection); //only active products
         Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($rcollection);//only visible products
        $rcollection->setPage(1,5);//limit to 5 products
        echo "$rcollection<br />";


texts: Customer_save_after observer - is it an update or a registration?

texts:
I have implemented an observer for customer_save_after event. Is there a way to know if it is a new customer registration or an update?

I cannot use the customer_register_success event as it is not triggered when the registration/update is done through the REST API. I assume that's because it's defined inside app/code/Magento/Customer/Controller/Account/CreatePost.php


texts: VAT-Id activated. missing field in shipping or billing address on checkout page

texts:
I've activated the option "Show Vat-Id in frontend" but the VAT-ID Field on the checkout page address forms is still not displayed.

How can i add the VAT-ID field to the address forms on the checkout page?


texts: Why the Magento 1.9.3.4 welcome email still send customer password in text plain?

texts:
Why Magento 1.9.3.4 welcome email still send customer password in plain text ?

I think this is not safe at all. I know that I can replace the line Password: {{htmlescape var=$customer.password}} to not show the passwords

I thought, after 1.9, it won't show passwords any more, but accidentally I found the welcome email include the password in plain text .

I wonder whether my magento codes have Security problem, because I think the password should not been seen and shown in any methods.


texts: Automatically have Terms & Conditions checked on checkout page

texts:
By default when the Terms and Conditions are enabled, visitors are required to tick / check "I agree" (Checkbox Text) to the Terms and Conditions of the website at the end of the checkout process.

To expedite the checkout process, I'd like to have this checkbox already selected.

What is the best method to automatically have the checkbox selected agreeing to the Terms and Conditions of the website on Checkout?


texts: How to hide fields with toggle checkbox in ui_component Magento 2

texts:
I have a toggle checkbox at product edit form:

Created as:

<field name="open_amount" formElement="checkbox">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="source" xsi:type="string">homeslider</item>
                        <item name="default" xsi:type="number">1</item>
                    </item>
                </argument>
                <settings>
                    <dataType>boolean</dataType>
                    <label translate="true">Open Amount</label>
                    <dataScope>status</dataScope>
                </settings>
                <formElements>
                    <checkbox>
                        <settings>
                            <valueMap>
                                <map name="false" xsi:type="number">0</map>
                                <map name="true" xsi:type="number">1</map>
                            </valueMap>
                            <prefer>toggle</prefer>
                        </settings>
                    </checkbox>
                </formElements>
            </field>
            <field name="min_val">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="label" xsi:type="string">Open Amount Min Value</item>
                        <item name="visible" xsi:type="boolean">true</item>
                        <item name="dataType" xsi:type="string">text</item>
                        <item name="formElement" xsi:type="string">input</item>
                        <item name="source" xsi:type="string">faq</item>
                    </item>
                </argument>
            </field>
            <field name="max_val">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="label" xsi:type="string">Open Amount Max Value</item>
                        <item name="visible" xsi:type="boolean">true</item>
                        <item name="dataType" xsi:type="string">text</item>
                        <item name="formElement" xsi:type="string">input</item>
                        <item name="source" xsi:type="string">faq</item>
                    </item>
                </argument>
            </field>

Can somebody show me how to add js component to show/hide both fields upon toggle on/off. Thanks


texts:
I need to add an option for searching product manuals. I have some pdf files as manuals which stored in folder named as it's manufacturer. Ex: manufacturer is ABC and manuals are abc-prmanu1.pdf, abc-prmanu2.pdf etc..

I have separate CMS page,(Search Page) that has a select/dropdown which should have the manufacturer names. upon selecting manufacturer, there is a button, on-click it should display every manual pdf files in another page.(View Page), which lists all available product manuals for selected manufacturer and have download links for each individual pdf file.

How can I accomplish this?

How can I store manufacturer names, manual names, ids and other data?(Do I need to use database or can I use some kind of attribute option?)

Please help me


texts: Grid column filter not working with two models in magento custom module

texts:
I'm working with custom module for the magento backend, in this filter not working when using filter calback!
Can anyone suggest me?
Thanks!

I have tried some codes like this,

Grid.php

protected function _prepareCollection()
    {
     $collection = Mage::getModel('listings/listings')->getCollection();
     $this->setCollection($collection);
       return parent::_prepareCollection();
    }
protected function _prepareColumns()
    {
        $this->addColumn("item_id", array(
            "header" => Mage::helper("linkmanagement")->__("ID"),
            "align" => "center",
            "type" => "number",
            "index" => "item_id",

        ));

        $this->addColumn("title", array(
            "header" => Mage::helper("linkmanagement")->__("Title"),
            "index" => "title"
        ));

        $this->addColumn("cat_ids", array(
            "header" => Mage::helper("linkmanagement")->__("Cat ID"),
            "align" => "center",
            "index" => "cat_ids",
            "renderer" => 'Sathish_Linkmanagement_Block_Adminhtml_Linkmanagement_Renderer_Categories',
            'filter_condition_callback' => array($this, '_categoriesFilter')
        ));

        $this->addColumn("url_key", array(
            "header" => Mage::helper("linkmanagement")->__("URL"),
            "index" => "url_key",
            "width" => "200px",
        ));

        $this->addColumn('status',
            array(
                'header' => Mage::helper('linkmanagement')->__('Status'),
                'index' => 'status',
                'type' => 'options',
                'options' => array('1' => Mage::helper('linkmanagement')->__('Active'),
                    '0' => Mage::helper('linkmanagement')->__('Inactive')),
            )
        );

        return parent::_prepareColumns();
    }

callback function

protected function _categoriesFilter($collection, $column)
    {
        if (!$value = $column->getFilter()->getValue()) {
            return $this;
        }

        $this->getCollection()->getSelect()->where(
            "cat_ids ?"
            , "%$value%");
        return $this;
    }

Categories.php

class Sathish_Linkmanagement_Block_Adminhtml_Linkmanagement_Renderer_Categories extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{

    public function render(Varien_Object $row)
    {
        $value =  $row->getData($this->getColumn()->getIndex());
        // $value = 38,92
        $value = explode(',',$value);
        $collection = Mage::getModel("categories/categories")->getCollection()->addFieldToFilter('category_id',$value)->getData();
        foreach($collection as $col){
            $result[] = $col['title'];
        }
        $result = implode(',', $result);// $result = schools,colleges
        return $result;
    }
}

Note:
Renderer working fine.,
only filter callback function is not working!!!


texts: I am new in Magento Framework. Here I did found header.phtml, logo.phtml, header links etc. But i can't figure out how all these files are bind together? What holds these together? If i have to add another div where should I add? Please help.


texts: Magento 1 : Adminhtml block not called in my custom module

texts:
I created a module to show the customer inquiries on product in admin grid.
From controller it is not directed to my block.Below is my code.

Config.xml

<config>
.....
<global>
    <blocks>
        <eight25media_requestquote>
            <class>Eight25media_Requestquote_Block</class>
        </eight25media_requestquote>
    </blocks>
..................
<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <requestquote>Eight25media_Requestquote_Adminhtml</requestquote>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>
..........
</config>

adminhtml.xml

<config>
<menu>
    <requestquote translate="title" module="requestquote">
        <title>Quotes</title>
        <sort_order>71</sort_order>
        <children>
            <quotemenus translate="title" module="requestquote">
                <sort_order>0</sort_order>
                <title>Manage Quotes</title>
                <action>adminhtml/quotes/</action>
            </quotemenus>
        </children>
    </requestquote>
</menu>
<acl>
    <resources>
        <admin>
            <children>
                <requestquote>
                    <title>Quotes</title>
                    <sort_order>60</sort_order>
                    <children>
                        <quotemenus translate="title">
                            <title>Manage Quotes</title>
                        </quotemenus>
                    </children>
                </requestquote>
            </children>
        </admin>
    </resources>
</acl>

QuotesController.php

class Eight25media_Requestquote_Adminhtml_QuotesController extends Mage_Adminhtml_Controller_action
{

    protected function _initAction()
    {
       $this->loadLayout();

       return $this;

     }

     public function indexAction() {

        $this->_title($this->__('Quotes'))->_title($this->__('Manage Quotes'));
        $this->loadLayout();
        $this->_setActiveMenu('requestquote/quotemenus');
        $this->_addContent($this->getLayout()->createBlock('requestquote/adminhtml_quotes'));
        $this->renderLayout();
     }

Block File : Quotes.php

<?php
class Eight25media_Requestquote_Block_Adminhtml_Quotes extends Mage_Adminhtml_Block_Widget_Grid_Container
{
public function __construct(){

    $this->_blockGroup = 'requestquote';
    $this->_controller = 'adminhtml_quotes';
    $this->_headerText = Mage::helper('requestquote')->__('Product Quote Collection');

    parent::__construct();
}
}

If i echo some thing in my block file nothing show and i am unable to access to my block file.What is the mistake i am doing here.


texts:
My requirement is
I have extension for the percent discount rule (Buy 1 Get 1 with X% rule) based on that i have created 3 rules below
1)Buy 1 watch get 1 bag 10 % offer
2)Buy 2 watch get 2 bags 20 % offer
3)Buy 3 watch get 3 bags 30 % offer
If i enable these rules only one rule applied but i need
1 watch and 1 bag rule 1 will apply
2 watch and 2 bags rule 2 will apply
3 watch and 3 bags rule 3 will apply
Please advise me?


texts:
I have a situation and I'm not sure what the best solution is.

In the user accounts (customers) I've added a single field that gives a list of all the manufacturers. The admin can select a set of manufacturers per customer.

When a customer logs in on the frontend, he should only be able to see the product of the manufacturers that are selected.

I was thinking of rewriting some pieces of the product model, but I'm not sure what would be the best location, any tips?


texts: Html validation issue for facebook sharing on product page

texts:
Checking product page html validation I realized we have html validation error for
facebook share button on product page. The error is

  "Bad value for attribute href on element a: Illegal character in
  query: [ is not allowed"

Please let me know how to fix this.


texts: Unable to apply patch Magento\InventorySales\Setup\Patch\Schema\InitializeWebsiteDefaultSock

texts:
When running a fresh install I am presented with this error.
This is using the lastest composer package, as per the Magento docs.
[Progress: 113 / 1106]
Module 'Magento_InventorySales':
In PatchApplier.php line 247:

  Unable to apply patch Magento\InventorySales\Setup\Patch\Schema\InitializeW
  ebsiteDefaultSock for module Magento_InventorySales. Original exception mes
  sage: The default website isn't defined. Set the website and try again.

The install command I am using is:
php bin/magento setup:install --base-url='https://YYY.mdoq.io/' --db-host='****' --db-name='magento' --db-user='magento' --db-password='****' --admin-firstname='Admin' --admin-lastname='Admin' --admin-email='admin' --admin-user='admin' --admin-password='****' --language='en_GB' --currency='GBP' --timezone='Europe/London' --use-rewrites=1 --cleanup-database


texts: How to get a list of all products in Magento 2?

texts: How can I get a list of all available products in Magento 2?


texts: Can't change product description in specific store view

texts:
I'm using Magento 2.3.
I have created some store View

But in my product i can't change short description and description, all the other field change without any problem, i can only change it in "default".
For example in this product, the Description field stay locked, and tinyMCE also. I have try also in HTML mode, but i can't change anything.

Thank for any help or idea.

Ben

Update

In each specific store view, the text area are disabled, but i don't understand why.


texts: Programmatically adding products to the cart with SCP

texts:
I am using the SCP extension so that prices are taken from the simple product and not the configurable.

My question is though how do I add a configurable product to a cart programmatically ensuring that it uses the correct prices?

$data=array(
            'product' => $product,
            'qty' => $params['qty'],
            'options' => $optData,
            'super_attribute' => $optConfigurableData
        );
$cart->addProduct($prod,$data);

This is how I normally would add a configurable product to the cart but this method uses the price from the configurable product and not the simple product


texts: How to set mobile number unique at the time of customer registration in magento

texts:
I have created a customer attribute mobile and include it with customer sign up form. Cutomer sign up is works also for mobile number and customer mobile number is save in database at the time of sign up.

But I want to set email and mobile both unique for customer sign up.

For this I have override createPostAction() function of customer/AccountController.php file.

What condition I have to put in this function to check unique email_id and mobile_number for customer?


texts:
I have created  an dropdown attribute programatically. Now i am trying to get an attribute value inside the class  using object manager but unfortunately i am facing  an error

function getServiceScheduleSlotss() is were i need the attribute value which is then called inside the function getAllOptions().

This is the Error i found in the error.log

"PHP Fatal error:  Uncaught Error: Call to a member function getAttributeText() on null in /var/www/html/magento2sample/app/code/Today/Slot/Model/Config/Source/Options.php:20"

Is there anyway to get attribute value here without using Object manager , If not how to solve this issue?

Also i have used this same method to get attribute value to a phtml using block and worked fine

<?php
namespace Today\Slot\Model\Config\Source;

use Magento\Eav\Model\ResourceModel\Entity\Attribute\OptionFactory;
use Magento\Framework\DB\Ddl\Table;

class Options extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
{
    /**
     * Get all options
     *
     * @return array
     */

    function getServiceScheduleSlotss() {

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');
    $slot_break = $product->getAttributeText('choose_slot_break');
    $slot_interval = $product->getAttributeText('choose_slot_intervel');
    $time_period_from = $product->getAttributeText('time_period_from');
    $time_period_to = $product->getAttributeText('time_period_to');
    $date_from = $product->getchooseDateFrom();
    $date_to = $product->getchooseDateTo();
    $slot_break = substr($slot_break,0,2);
    $slot_interval = substr($slot_interval,0,2);
    $date_from = substr($date_from,0,10);
    $date_to = substr($date_to,0,10);

        $start = new \DateTime($time_period_from);
        $end = new \DateTime($time_period_to);
        $interval = new \DateInterval("PT" . $slot_interval. "M");
        $slot_breakInterval = new \DateInterval("PT" . $slot_break. "M");

        for ($intStart = $start;
             $intStart < $end;
             $intStart->add($interval)->add($slot_breakInterval)) {

               $endPeriod = clone $intStart;
               $endPeriod->add($interval);
               if ($endPeriod > $end) {
                 $endPeriod=$end;
               }
               $periods[] = $intStart->format('H:iA') .
                            ' - ' .
                            $endPeriod->format('H:iA');
        }

        return $periods;
    }

    public function getAllOptions()
    {
        $periods = $this->getServiceScheduleSlotss();
        $this->_options = [
            ['label'=>'', 'value'=>''],
            ['label'=>'10-11', 'value'=>'1'],
            ['label'=>'12-13', 'value'=>'2'],
            ['label'=>'15-16', 'value'=>'3']
        ];
        return $this->_options;
    }

    /**
     * Get a text for option value
     *
     * @param string|integer $value
     * @return string|bool
     */
    public function getOptionText($value)
    {
        foreach ($this->getAllOptions() as $option) {
            if ($option['value'] == $value) {
                return $option['label'];
            }
        }
        return false;
    }
}


texts: Get all guest & customer email id's in single collection Magento 2

texts:
I am trying to list all unique email id's (guest & customers) in admin grid to restrict specific email id to place order.

For that, I got an id's from customer collection and order collection.

But I need this in the single collection.

name | email
A    | aa@aa.com
B    | bb@bb.com
C    | cc@cc.com

FYI:

/* \Magento\Customer\Model\CustomerFactory */
$customerCollection = $model->getCollection();
$customerCollection->getSelect()
    ->reset(\Zend_Db_Select::COLUMNS)
    ->columns(
    [
        'name' => "CONCAT(firstname, ' ', lastname)",
        'email' => 'email'
    ]
);

/* \Magento\Sales\Model\OrderFactory */
$orderModel = $this->_orderFactory->create();
$orderCollection = $orderModel->getCollection();
$orderCollection->addAttributeToFilter('customer_is_guest', ['eq' => 1]);
$orderCollection->getSelect()
    ->reset(\Zend_Db_Select::COLUMNS)
    ->columns(
        [
          'name' => "CONCAT(customer_firstname, ' ', customer_lastname)",
          'email' => 'customer_email'
        ]
    );

Even I tried with preparing a new collection \Magento\Framework\Data\Collection && \Magento\Framework\DataObject in this cases filter, page size, cur page not working.

After collecting those data need to list in admin grid.

Please suggest the possible way?

Thanks


texts: Magento 2 : Admin page pages redirect to Admin my account

texts: After login My magento 2 admin all pages are redirect to admin my account page i dont now what happen. its work yesterday good. issue start today.


texts: magento 2.3 observers on product attributes save/changes

texts:
on my magento 2.3 I need to detect when a particular product attribute is updated in order to change the product price. Changing the product attribute via backend is no big deal: I simply put an observer on the catalog_product_save_after event and check my current attribute value against $product->getOrigData('attribute_code') to see if it's changed.
The problemi is: when the attribute is imported via csv import feature, that observer is not called. Instead, the catalog_product_import_bunch_save_after event is called. But here I have no way of retrieving the original value of the attribute (because it is called after the save) and the event catalog_product_import_bunch_save_before (that would hold the original data) doesn't exist.
So now my question is: how can I get the original data for my attribute during the csv import? If I can't with the observer I'm using, which observer/plugin should I use?
Thanks


texts: Magento 2.2.4 blank body tag except home page and on all other pages

texts:
I've Magento 2.2.4. I already have files on bitbucket. I downloaded files of app/code modules and merged with fresh Magento 2.2.4 and imported the database which already exists. After running composer install, composer update, module upgrade, static content deployment, compilation, and cache refresh commands, the home page works fine but the all other pages like category page, cms pages are having a white screen and body tag with no content. When I try to navigate admin it shows too many redirects error.
I'm using wamp server on local.


texts: How to set timezone when save and retrieve data on Magento

texts:
I've changed the

System->Configuration->General->Locale Options->Timezone

to ID and saved.

the data is 2013-09-30 12:03 when saved.

but when i see on Admin Grid the data is : Sep 30, 2013 7:03:00 PM

and when i edit it. it shows 2013-09-30 12:03

on the database the data is 2013-09-30 12:03:00

The weird thing is on Admin Grid, the data isn't the same with the database.


texts:
I have made some changes in my custom module to enable store view field and made a upgrade file to create table to store store id data as follows. but its not working. its not even giving me an error.

$installer = $this;
$installer->startSetup();
$table = $installer->getConnection()
    ->newTable($installer->getTable('custom/expert_store'))
    ->addColumn('expert_id',Varien_Db_Ddl_Table::TYPE_SMALLINT,null,
        array(
            'nullable'  => false,
            'primary'   => true,
        ),
        'Expert ID'
    )
    ->addColumn('store_id',Varien_Db_Ddl_Table::TYPE_SMALLINT,null,
        array(
            'unsigned'  => true,
            'nullable'  => false,
            'primary'   => true,
        ),
        'Store ID'
    )
    ->addIndex($installer->getIdxName(
            'custom/expert_store',
            array('store_id')
        ),
        array('store_id')
    )
    ->addForeignKey(
        $installer->getFkName(
            'custom/expert_store',
            'expert_id',
            'custom/expert',
            'entity_id'
        ),
        'expert_id',
        $installer->getTable('custom/expert'),
        'entity_id',
        Varien_Db_Ddl_Table::ACTION_CASCADE,
        Varien_Db_Ddl_Table::ACTION_CASCADE
    )
    ->addForeignKey(
        $installer->getFkName(
            'custom/expert_store',
            'store_id',
            'core/store',
            'store_id'
        ),
        'store_id',
        $installer->getTable('core/store'),
        'store_id',
        Varien_Db_Ddl_Table::ACTION_CASCADE,
        Varien_Db_Ddl_Table::ACTION_CASCADE
    )
    ->setComment('Expert To Store Linkage Table');
$installer->getConnection()->createTable($table);
$installer->endSetup();


texts: Cannot update order state and status programatically

texts:
This is my first attempt:
$orderId = 57;

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('\Magento\Sales\Model\Order')->load($orderId);
$order->setState(\Magento\Sales\Model\Order::STATE_PROCESSING, true);
$order->setStatus(\Magento\Sales\Model\Order::STATE_PROCESSING);
var_dump($order->getStatus()); // here i can see that it is processing
$order->save(); // if i put this in a try and catch, no exception is thrown

another attempt:
//using OrderRepositoryInterface
$order = $this->orderRepositoryInterface->get(57);
$order->setState('processing')->setStatus('processing');
$this->orderRepositoryInterface->save($order); // if i put this in a try and catch, no exception is thrown

Are they other approaches to try to change the order state and status ? Or am i doing something wrong with my attempts? since they are not working :(
Thank you


texts: How Best seller tables gets populated Magento 2?

texts:
There are 3 tables related to bestseller in Magento 2

 sales_bestsellers_aggregated_daily
 sales_bestsellers_aggregated_monthly
 sales_bestsellers_aggregated_yearly

How and when these tables get populated.
Is there any sort of cron that populates these tables as soon as a user completes an order?

data's are wrong on these 3 tables, 90% of products don't exist in catalog_product_entity
That product_id from these 3 tables sales_bestsellers_aggregated_daily
 sales_bestsellers_aggregated_monthly
 sales_bestsellers_aggregated_yearly doesn't exist anywhere


texts: Magento1 to Magento2 data migration error

texts:
I am having A big problem migrating from 1.9.2.1 to 2.1.3

I have not found a solution on the web that worked for me.

When I run migration for the 1st time:

[Exception]
  Notice: Undefined offset: 23 in ../../..//vendor/magento/data-migration-tool/src/Migration/Step/Eav/Data.php on line 532

When I run migration for the 2nd time:

Integrity constraint violation: 1062 Duplicate entry '1-Migration_Default' for key 'EAV_ATTRIBUTE_SET_ENTITY_TYPE_ID_ATTRIBUTE_SET_NAME'

The second message is understandable cause whes I look at the at EAV_ATTRIBUTE_SET table in magento 2 it's been migrated.

But the first notice message is where the problem start.

Does anyone came across this issue and perhaps guide me please on what else to look for I appreciate for help Thank you.


texts: How to modify search so when input "GM321" it shows the "GM-321" sku number?

texts:
Currently if the customer search by SKU, he need to enter the precise part number. For example, for part number DMS-212, customer must search DMS-212, if he input DMS212, search doesn't work.
Is there any way to make it work so the search find the "likes" SKUs?
Thanks in advance for any advice.


texts: First I export my product in a csv file and then i try to reimport but during check magento fail with general exception.Someone can help me about this issue?


texts: Sub Category image Show in Page using phtml file

texts:
I am using template phtml added php code. this call from static block.Url and link works fine but It's not view any sub category image. I want to show sub category images.

$category = Mage::getModel('catalog/category')->load(12);
$subcategories = $category->getChildrenCategories();
if (count($subcategories) > 0){
  foreach($subcategories as $subcategory) { ?>

 <a class="product-image" href="<?php echo $subcategory->getURL(); ?>" >

   <img alt="" src="<?php echo $subcategory->getImageUrl(); ?>" />

   <a href="<?php echo $subcategory->getURL(); ?>" > <?php   echo $subcategory->getName(); ?>

      <?php echo '
' ?>


texts: Magento 2 Extension submission to Marketplace

texts:
Problem is related to Marketplace extension submission.

Whenever i submit a new extension, it response back with this error message "An error occurred, please try again later." with no other information, where to check or fix problem.
This is a Magento 2 module,
This situation is only for my two modules out of 13. dont know why its happening. i removed all directories and files from except registration.php & composer.json & module.xml But error remains same.
Contacted the Marketplace but no clue yet after 40 days now m here,

Here is screen-shot attached.

May anyone faced this kind of problem.


texts: How do i get total cart count in magento?

texts:
I want to get total cart count it means how many times a particular product was added to cart. I know I have to use statement like this:

$Products = Mage::getResourceModel('reports/product_collection')->AddCartsCount();

But not getting how to approach from here. please help me to get total cart count of a product.


texts: Call custom Js to particular page only Magento 2

texts:
I created a custom module in Magento 2, in this i am using one external js library and one my js file in which i put all my custom js to handle the extension whenever required suing the requirejs-config.js

IN /var/www/html/magento2/app/code/Hestabit/ReviewRating/view/frontend/requirejs-config.js

I want to load this file only on home page i.e cms_index_index.xml and cart page i.e  cms_index_index.xml in these file we use  to include the custom css or include custom phtml.

I used above xml to call my custom phtml only on those pages.
My requirejs-config.js

var config = {

    deps: [
        "NameSpace_ReviewRating/js/main",
    ],

     map: {
        '*': {
            'slickjs': 'NameSpace_ReviewRating/js/slick/slick',
            'sliderjs': 'NameSpace_ReviewRating/js/slick/tiny-slider'

        }
    },

    shim: {
        "slickjs": ["jquery"],
        "sliderjs": ["jquery"]

    }

};

In my main.js I am trying to get some id value which will be available only on home and cart page so on other pages it is throwing not found the error in console.


texts: How to fix the error “Notice: Undefined variable : block in app/code/core/Mage/Core/Model/Email/Template/Filter.php”

texts:
After I have installed the following patches: SUPEE-6285-1.9.1v2, SUPEE-6482-1.9.1.1, SUPEE-6788-1.9.1.1, SUPEE-7405-1.9.1.1,
my system.log file is filled with full of the following errors:

  Notice: Undefined variable: block in app/code/core/Mage/Core/Model/Email/Template/Filter.php on line 187
  Notice: Undefined variable: block in app/code/core/Mage/Core/Model/Email/Template/Filter.php on line 197

How to fix the issue...

Here is the block code:

    /**
 * Retrieve Block html directive
 *
 * @param array $construction
 * @return string
 */
public function blockDirective($construction)
{
    $skipParams = array('type', 'id', 'output');
    $blockParameters = $this->_getIncludeParameters($construction[2]);
    $layout = Mage::app()->getLayout();

    if (isset($blockParameters['type'])) {
        if ($this->_permissionBlock->isTypeAllowed($blockParameters['type'])) {
            $type = $blockParameters['type'];
            $block = $layout->createBlock($type, null, $blockParameters);
        }
    } elseif (isset($blockParameters['id'])) {
        $block = $layout->createBlock('cms/block');
        if ($block) {
            $block->setBlockId($blockParameters['id']);
        }
    }

 **LINE 187**   if ($block) {
        $block->setBlockParams($blockParameters);
        foreach ($blockParameters as $k => $v) {
            if (in_array($k, $skipParams)) {
                continue;
            }
            $block->setDataUsingMethod($k, $v);
        }
    }

 **LINE 197**   if (!$block) {
        return '';
    }
    if (isset($blockParameters['output'])) {
        $method = $blockParameters['output'];
    }
    if (!isset($method) || !is_string($method) || !method_exists($block, $method)) {
        $method = 'toHtml';
    }
    return $block->$method();
}

any help would be appreciated...


texts: Issue with multiple custom product details tabs not displaying

texts:
In catalog_product_view.xml I have the following section:

<referenceBlock name="product.info.details">
  <block class="Magento\Framework\View\Element\Template" template="Magento_Catalog::product/tabs/tab1.phtml" name="extra-tab-1" group="detailed_info">
    <arguments>
      <argument name="title" translate="true" xsi:type="string">Extra Tab 1</argument>
    </arguments>
  </block>
  <block class="Magento\Framework\View\Element\Template" template="Magento_Catalog::product/tabs/tab2.phtml" name="extra-tab-2" group="detailed_info">
    <arguments>
      <argument name="title" translate="true" xsi:type="string">Extra Tab 2</argument>
    </arguments>
  </block>
</referenceBlock>

My issue is that only "Extra Tab 2" shows up on the product page. If I remove that block and clear caches, "Extra Tab 1" is then displayed.

I was hoping someone had experienced a similar issue and could point me towards a cause. There are no other custom modules or themes interfering with the product page layout.