Skip to content

magento man

How I can reference product SKU as foreign key reference?

In my db_schema.xml I made a table with a pivot one: <?xml version=”1.0″?> <schema xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd”> <table name=”blog_posts” resource=”default” engine=”innodb” comment=”Blog articles”> <column xsi:type=”int” name=”blog_post_id” unsigned=”true” nullable=”false” identity=”true” comment=”primary_key”/> <column xsi:type=”varchar” name=”title” comment=”Blog Post’s title” /> <column xsi:type=”text” name=”post” comment=”Blog… Read More »How I can reference product SKU as foreign key reference?

Get customer orders excluding ones with a specific order item

I want to retrieve all customer orders’ except the ones that have a specific item (walle product) Currently, I get all orders that have the item and then filter them from orderCollection $orderItemCollection = $this->orderItemCollectionFactory->create(); $orderItemCollection->addFieldToFilter(‘sku’, Data::WALLET_PRODUCT_SKU); $walletOrders = [];… Read More »Get customer orders excluding ones with a specific order item

How I can retrieve the Image Url of a given product?

I have a custom block in magento 2.4 where I retrieve a image List namespace PcmagasFirstModuleBlockMyList; use MagentoCatalogModelProductRepository; use MagentoFrameworkApiSearchCriteriaBuilder; use MagentoFrameworkViewElementTemplate; class MyList extends Template { private ProductRepository $productRepository; private SearchCriteriaBuilder $searchCriteriaBuilder; public function __construct( TemplateContext $context, ProductRepository $productRepository,… Read More »How I can retrieve the Image Url of a given product?