Hot answers tagged

8

Here is what you can do. Update your button code to pass current product name to your controller action like below. <button> <a href="<?php echo Mage::getUrl("example/amasty/createSimpleProductAndRedirect", array('name' => $_product->getName())); ?>">Create product</a> </button> Update your function ...


8

You need to a custom extension with plugins, I followed this app/code/Company/CustomSort/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Catalog\Model\Config"> <plugin name="...


5

The answer provided by Jaimin should work, but for a general and extensible solution.... You can send to the create product link, the id of the product you are cloning. Then you can just take whatever you need from the original product. Make the link look like this: <?php echo Mage::getUrl("example/amasty/createSimpleProductAndRedirect", array('id' ...


5

It's just part of Magento's architecture to use a first name and a last name. Your question asks why this is the case. Presumably, Magento has added the firstname and lastname attributes (along with even an optional middlename one is defined as default but not displayed) to provide as much flexibility as possible for the merchant. This is a departure from ...


4

As per Magento Standard. In Manage Customer Grid you can see the Full name with Prifix FirstName LastName. You have to override the Customer Grid and Add new Field In grid. Step 1: app\code\core\Mage\Adminhtml\Block\Customer\Grid.php Copy this file to app\code\local\Mage\Adminhtml\Block\Customer\Grid.php. Step 2: Find _prepareColumns() method in this ...


3

Try this: EDIT: file location: app/design/frontend/your_package/your_theme/template/page/html/header.phtml Add these in this file where you want to get the name to be shown. <?php if (Mage::getSingleton('customer/session')->isLoggedIn()): ?> <?php echo Mage::getSingleton('customer/session')->getCustomer()->getName() ?> <?php ...


3

if($_GET['keyword']!=''){ $needle= $_GET['keyword']; $collection->addAttributeToFilter('name', array( array('like' => '% '.$needle.' %') )); You need to remove the empty space in the '%' quotes. if($_GET['keyword']!=''){ $needle= $_GET['keyword']; $collection->addAttributeToFilter('name', array( array('like' => '%'.$needle.'%') ));


3

If your template extends \Magento\Framework\View\Element\Template then you you have access to request via $this->_request


2

Take a look at Magento Migrate customers with no password. $customer = Mage::getModel('customer/customer'); $password = '123456'; $email = 'testuser@test.com'; $customer->setWebsiteId(Mage::app()->getWebsite()->getId()); $customer->loadByEmail($email); if($customer->getId()) { // if customer does not already exists, by email $...


2

The problem is, that inside the cart checkout/cart/render/simple.phtml the default to get the name is: <?php echo $this->escapeHtml($this->getProductName()) ?> And this gets the name from the product, rather then from the item. public function getProductName() { if ($this->hasProductName()) { return $this->getData('...


2

I assume that you're doing this on a Magento 2.x site? One of the key things that was done with Magento 2 was a streamlining of the checkout process. The less you need to ask for, the faster a customer can part with their money. So fields like name on card and credit card type were removed. And the system also uses assumes that your billing and shipping ...


2

The main problem here is that two categories can have the same name and your code does not take that into consideration. Here's how I would attack this problem: $collection = Mage::getResourceModel('catalog/category_collection') ->addAttributeToSelect('entity_id') ->addAttributeToFilter('name', $name); $ids = $collection->getColumnValues('...


2

Go to your current theme and your current header, some themes uses different headers : app/design/frontend/default/themek/te‌​mplate/page/html/hea‌​der.phtml for exemple then add this: <?php if ( Mage::getSingleton('customer/session')->isLoggedIn() ): ?> <div class="customer-name"> <?php echo Mage::getSingleton('customer/...


2

Vendor is updating via composer.json. You shouldn't make changes directly in vendor, because source is downloading directly from repositories. You can make changes directly in local env, bout you wont be able to push it into project repo. I see you made changes in core magento module (really? Its bad bad idea - never do that!). You should use rewrites in ...


2

Make a category Collection in 1.x Version then filter That Collection in condtion; $collection=Mage::getResourceModel('catalog/category_collection') ->addAttributeToFilter('name',['in' =>$arr]); Then those category ids by getAllids() $collection->getAllIds(); Or: $collection=Mage::getResourceModel('catalog/category_collection') ->...


2

namespace Company\Module\Block; class CustomBlock extends \Magento\Framework\View\Element\Template { protected $_categoryFactory; public function __construct( \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Framework\View\Element\Template\Context $context, ) { $this->_categoryFactory = $categoryFactory; ...


1

You SHOULD NOT update/change anything in vendor folder if that is template level change then you should copy that file in your theme folder and make necessary changes and then push to your cloud branch / environment. in order to make above changes copy : module-customer/view/templates/widget/name.phtml file and paste in : app/design/frontend/Vendorname/...


1

checkout_cart_index.xml <referenceBlock name="additional.product.info"> <block class="Gaurav\Companyname\Block\Showcategory" name="showcategory" template="Gaurav_Companyname::categoryname.phtml"/> </referenceBlock> Gaurav\Companyname\Block\Showcategory.php <?php namespace Gaurav\Companyname\Block; use Magento\Framework\...


1

I would suggest you to use categoryCollection instead of loading each category with a particular database query. This will result into a better performance when loading the cart page. Also, if $item is instance of quoteItem, you don't have to load the product again because you can find it inside quoteItem object. So, check the following code. <?php $item ...


1

When the customer is logged in, you can get customer session in frontend from any phtml file. To show customer name in header, you would need to open header.phtml file located at: app/design/frontend/yourpackage/yourtheme/template/page/html/ folder and write below code where you want to display current logged in customer name: <?php if (Mage::...


1

Try below $allCategoryIds = ALL_YOUR_CATEGORIES_AS_ARRAY; foreach($allCategoryIds as $categoryId){ $_category = Mage::getModel('catalog/category')->load($categoryId); echo $categoryName = $_category->getName()."<br />"; }


1

Fix this issue. Do following thing To change URL, Run indexing for url Clear cache Hope this works


1

Supposing you're not really too fussed about having a GUI to upload them, you can implement it this way. Put the following function in a custom helper for example, and call it in your catalog/product/list.phtml for each product. Assuming you create a folder in media/catalog/category called icons and you upload there the icons named as such: {CATEGORY_ID}.png ...


1

Yes it is possible. Try this way: $this->helper('core/string')->truncate($product->getName(), 65,'...', $_reminder, false); Here $product is an object and 65 is letter count. You can try with increasing/decreasing it as per your need. Hope this helps. Ref: Take a look at this file/function //code/core/Mage/Core/Helper/String.php public ...


1

Changing prices is no problem, you can set whatever special price you wnat. But changing the name is no possible out of the box. You can implement a module to do this. But if you ask me, it is a bad idea to print other things on orders than on invoices. So better create the products.


1

Why change the name of the product on cart add? Just add a secondary product attribute and then display that in the cart item render rather than the product name.


1

this is not exactly a magento question... the easiest solution is to add fixed width to .best-sell-product .best-sell-product {width: 150px;} the rule can be found in http://kidsdial.com/skin/frontend/default/default/marketplace/css/wk_block.css line 95. If css is not an option, you can split the name using PHP, inserting a <br> after N chars (use ...


1

Magento customer name in Customer grid is depends on addNameToSelect function on class Mage_Customer_Model_Resource_Customer_Collection. So,they may create issue on 1)on function addNameToSelect this field value comes with concatenate with prefix+firstname+middlename+lastname+suffix. logic a)prefix(optional depends on setting ) b)firstname c)...


1

As you customer grid collection comes from Mage::getResourceModel('customer/customer_collection') ->addNameToSelect()h then this collection will consist of firstname and lastname in collection then you can first name and list name easily just copy app/code/core/Mage/Adminhtml/Block/Customer/Grid.php to app/code/local/Mage/Adminhtml/...


1

Sure you can set this up. You simply need to have one store-view for each domain. These can be setup under System->Manage Stores. I am not sure 100% of your set-up but you can have one website, one store and then one store-view for each domain. Then under System->Configuration->Web you can assign each store view with it's own url using the drop ...


Only top voted, non community-wiki answers of a minimum length are eligible