Skip to content

Instantly share code, notes, and snippets.

View blopa's full-sized avatar
πŸ΄β€β˜ οΈ

Pablo Benmaman blopa

πŸ΄β€β˜ οΈ
View GitHub Profile
@blopa
blopa / i-built-a-retro-rpg-game-shop-extension-for-my-magento-2-store-script-10.html
Created April 25, 2026 19:06
Code for post "I built a retro RPG game shop extension for my Magento 2 store"
<!-- Category Tabs -->
<div v-if="activeView === 'list'" class="flex flex-wrap gap-2 mb-3">
<button v-for="cat in categories" :key="cat.id"
class="px-3 py-1 border border-orange-500 hover:bg-orange-500 hover:text-black transition"
:class="{'bg-orange-500 text-black': currentCategoryId === cat.id}"
@click="loadProducts(cat.id, cat.name)">
{{ cat.name }}
</button>
</div>
@blopa
blopa / i-built-a-retro-rpg-game-shop-extension-for-my-magento-2-store-script-9.html
Created April 25, 2026 19:06
Code for post "I built a retro RPG game shop extension for my Magento 2 store"
<button class="block w-full py-3 border border-orange-500 hover:bg-orange-900 text-center px-4 text-lg"
:class="{'bg-orange-500 text-black': menuSelection === 'Buy'}"
@click="onMenuItemClick('Buy')">
<?= __('Buy'); ?>
</button>
<button class="block w-full py-3 border border-orange-500 hover:bg-orange-900 text-center px-4 text-lg"
:class="{'bg-orange-500 text-black': menuSelection === 'Sell'}"
@click="onMenuItemClick('Sell')">
<?= __('Sell'); ?>
@blopa
blopa / i-built-a-retro-rpg-game-shop-extension-for-my-magento-2-store-script-8.html
Created April 25, 2026 19:06
Code for post "I built a retro RPG game shop extension for my Magento 2 store"
<!-- Shopkeeper Avatar -->
<div class="border-2 border-orange-500 p-2 flex justify-center items-center bg-black">
<img src="<?= $block->getViewFileUrl('Werules_GameShop::images/shopkeeper.png'); ?>"
alt="<?= __('Shopkeeper Avatar'); ?>"
class="w-32 h-32 object-cover border border-orange-500 bg-black avatar">
</div>
<!-- Cart Count -->
<div class="mb-4">
<div class="text-lg text-orange-400"><?= __('Cart items:'); ?></div>
@blopa
blopa / i-built-a-retro-rpg-game-shop-extension-for-my-magento-2-store-script-7.html
Created April 25, 2026 19:06
Code for post "I built a retro RPG game shop extension for my Magento 2 store"
<div class="border-2 border-orange-500 p-3 sticky top-0 bg-black z-50">
<h1 class="text-3xl md:text-4xl font-bold tracking-widest uppercase">
<?php echo $currentStoreName; ?>
</h1>
</div>
@blopa
blopa / i-built-a-retro-rpg-game-shop-extension-for-my-magento-2-store-script-6.html
Created April 25, 2026 19:06
Code for post "I built a retro RPG game shop extension for my Magento 2 store"
<div id="app" class="min-h-screen bg-black text-orange-200 font-mono p-6 flex flex-col space-y-4 text-lg">
@blopa
blopa / i-built-a-retro-rpg-game-shop-extension-for-my-magento-2-store-script-5.php
Created April 25, 2026 19:06
Code for post "I built a retro RPG game shop extension for my Magento 2 store"
public function getProductsByCategoryId($categoryId)
{
if (!$this->isModuleEnabled()) {
return [];
}
// Standard product retrieval logic
}
@blopa
blopa / i-built-a-retro-rpg-game-shop-extension-for-my-magento-2-store-script-4.php
Last active April 25, 2026 19:06
Code for post "I built a retro RPG game shop extension for my Magento 2 store"
public function getCartItemCount()
{
if (!$this->isModuleEnabled()) {
return 0;
}
$quote = $this->cart->getQuote();
return (int)$quote->getItemsQty();
}
@blopa
blopa / i-built-a-retro-rpg-game-shop-extension-for-my-magento-2-store-script-3.php
Created April 25, 2026 19:06
Code for post "I built a retro RPG game shop extension for my Magento 2 store"
<?php
namespace Werules\GameShop\Controller\Index;
use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\App\Config\ScopeConfigInterface;
class Index extends Action
{
@blopa
blopa / i-built-a-retro-rpg-game-shop-extension-for-my-magento-2-store-script-2.xml
Created April 25, 2026 19:06
Code for post "I built a retro RPG game shop extension for my Magento 2 store"
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="werules_gameshop" frontName="game-shop">
<module name="Werules_GameShop"/>
</route>
</router>
</config>
@blopa
blopa / i-built-a-retro-rpg-game-shop-extension-for-my-magento-2-store-script-1.text
Created April 25, 2026 19:06
Code for post "I built a retro RPG game shop extension for my Magento 2 store"
app/code/Werules/GameShop/
β”œβ”€β”€ Api/
β”‚ β”œβ”€β”€ CartManagementInterface.php
β”‚ β”œβ”€β”€ CategoryManagementInterface.php
β”‚ β”œβ”€β”€ ProductManagementInterface.php
β”œβ”€β”€ Controller/
β”‚ β”œβ”€β”€ Index/
β”‚ β”‚ β”œβ”€β”€ Index.php
β”œβ”€β”€ etc/
β”‚ β”œβ”€β”€ adminhtml/