Categories
Mastering Development

how to remove keys from a params array of hashes

I have a list of params. As you can see from the code, i have a sales_attributes key, which can contain an unlimited array of hashes. What i’m trying to do is remove the ‘name’ and ‘code’ keys and values from each sales_attributes array. I’ve tried iterating over each sales_attributes and doing .delete, .except or […]

Categories
Mastering Development

It is possible to do extra aggregation in filter clause? (PostgreSQL)

I want to write something like this: select “id”, “plant”, “product”, “uom”, count(*) as transactions_count, avg((“invoice_price” / “quantity”)) filter (where (“date” == max(date)) as “LAST_GUIDANCE”, — I want group by date only for this from “transactions” group by “id”, “plant”, “product”, “uom” Where I want to count last guidance but only for rows with last […]

Categories
CMS Magento Mastering Development

AbstractType plugin not being called

I’m trying to add a plugin for Magento\Catalog\Model\Product\Type\AbstractType. I’ve got a 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\Product\Type\AbstractType”> <plugin name=”plugin_abstracttype” type=”MyModules\Module1\Plugins\AbstractType”/> </type> </config> and corresponding MyModules\Module1\Plugins\AbstractType class: namespace MyModules\Module1\Plugins; use Magento\Quote\Model\Quote\Item; class AbstractType { protected $logger; public function __construct(\Psr\Log\LoggerInterface $logger) { die(‘constructor’); $this->logger->warning(“constructor called”); $this->logger = $logger; } public function beforePrepareForCart(\Magento\Catalog\Model\Product\Type\AbstractType $abstractType, \Magento\Framework\DataObject $buyRequest, […]

Categories
CMS Mastering Development Wordpress

Safari giving Undefined index error on AJAX POST submit in WordPress

I am developing a unique cart plugin on WordPress. I am having weird Undefined index error only on Safari. I don’t understand why it is only on safari while working fine on other browsers. Please watch this video, there I have explained in detail. Video https://youtu.be/j7wxcUYw-hU Jump directly on the issue point https://youtu.be/j7wxcUYw-hU?t=165 Error [08-May-2020 […]

Categories
CMS Mastering Development Wordpress

Woocommerce Multisite global search how to mod ajax function?

I created an installation of my multisite ecommerce to differentiate the men’s and women’s departments. Often, however, it happens that in the men’s department they do research related to women’s articles or vice versa. Consequently, my site says it cannot find an article, obviously it is not so. How can I implement a global search […]

Categories
Mastering Development

Keeping duplicate tuple values if they are present inside separate tuples but only keeping unique tuple values if they are in the same tuple

I have a list of tuples: What I want to do is to keep only the entities which have unique numbers inside each tuple. dataset = [(‘made of iron oxide’, {‘entities’: [(12, 16, ‘PRODUCT’), (17, 20, ‘PRODUCT’), (15, 24, ‘PRODUCT’), (12, 19, ‘PRODUCT’)]}),(‘made of ferric oxide’, {‘entities’: [(10, 15, ‘PRODUCT’), (17, 20, ‘PRODUCT’), (624, 651, […]

Categories
Database Development

Deciding what values should be used in a data warehouse dimension?

I’m beginning to look at data warehousing and I’m coming across examples where, for instance, we have check payment transactions. I understand that this should be the “fact” and we would have dimensions around it that would describe the fact (account, product, etc.). However, it also contains things like “memo line” and string “transaction id” […]

Categories
CMS Magento Mastering Development

Redirect to checkout or last visited page before login or account creation

I’m working on a plugin that when the customer logins or creates an account it redirects to checkout page if there is any product on cart, if the cart is empty I want to redirect to last visited page (home, product, category, etc.). If I user the referrer page I will return to /customer/account/login in […]

Categories
Database Development

Primary key advice for simple table

I’m making a sample database to test myself in MySQL workbench and was wondering the following: I have five tables, Customer, Product, Stock(Quantity), Warehouse and Purchase Order. For primary keys I have customerId, productId, warehouseId, and invoiceNo…but what would the stocks primary key be? Apologies if the answer is obvious, but as I understand it […]

Categories
CMS Mastering Development Wordpress

Products are repeated in Woocommerce category

I just created a “special” category for a product type. But the products are repeated by three. Thanks in advance. Link: https://aventurasport.cl/product-category/parapente/ <?php $args = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => 3, ‘product_cat’ => ‘parapente’ ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?> <li class=”product”> <div class=”todooo”> […]