magento2 – Different category structure and a subnet of products

magento2 – Different category structure and a subnet of products – Magento Stack Exchange

woocommerce offtopic – adding surcharge based on subcategory and category

    // Add percentage based additional fee or surcharge

add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_surcharge' );
function woocommerce_custom_surcharge() {
  global $woocommerce;

    if ( is_admin() && ! defined( 'DOING_AJAX' ) )
        return;

    $percentage = 0.3; // Add your percentage here
    $surcharge = ( $woocommerce->cart->cart_contents_total + $woocommerce->cart->shipping_total ) * $percentage;    
    $woocommerce->cart->add_fee( 'Surcharge', $surcharge, true, '' );

}

this is all good but I want to add a surcharge based on the product category and subcategory too. is there any option to that ?

wp : 5.8
php 8.0.7

magento2 – when saving category with other language get invalid key url

i am using magento version 2.2.3 . when I want to save new category in other language from English I get invalid URL key error . this is my log in var folder of magento project

Invalid URL key {“exception”:”(object) (MagentoFrameworkExceptionLocalizedException(code: 0): Invalid URL key at E:wamp64wwwmagentovendormagentomodule-catalog-url-rewriteObserverCategoryUrlPathAutogeneratorObserver.php:61)”} ()

how to solve it and with what extension?

magento2 – How to get current category Id?

I’m trying to get the current category id (the id of the category I’m browsing on frontend).

 public function __construct(
    Context $context,
    Resolver $layerResolver,
    PsrLogLoggerInterface $logger,
    array $data = ()
)
{
    parent::__construct($context, $data);

    $this->layerResolver = $layerResolver;
    $this->logger = $logger;
}

public function getCurrentCategory()
{
    return $this->layerResolver->get()->getCurrentCategory();
}

public function getCurrentCategoryId()
{
    return $this->getCurrentCategory()->getId();
}

I’m using layerResolver as suggested here: https://stackoverflow.com/a/46414822

But I’m not getting the current id.

Magento 2 URL rewright for category page

How can i change my category URL from "www.domine.com/catalog/category/view/s/shop/id/22/" to "www.domine.com/shop"?

How can I get the first level category list?

I’d like to list all first level categories from inside my custom block. I’d like to get the category names and the URLs.

How can I achieve this?

ecommerce – How to organize category tree in my e-commerce for best SEO results?

My store sells just one type of product (e.g. Computers). What’s the best way to organize the category tree?

Should I include the main topic in order to permit my customers to browse all my products in 1 single page?

  • Computers –> Asus –> Intel

or simply:

?

custom post types – CPT EVENT – listing by month and filtering by category and month – form select option

I am creating custom post type eventlist filter form. There is two options: category and months.
Following this advice List events by month I got display event categories by month. Meaning…

January

  • Event post 1
  • Event post 2

February

  • Event post 1
  • Event post 2

etc.

Category choosing works smoothly. Problem comes up when user choose month. By default events are listed by month. How can I reorder events using form options? Is it possible solve using meta_query compare or do I need some other solution?

<form method="get" action="<?php the_permalink();?>" name="tapahtumalista">
<select class="form-select" name="kat">

<?php 
$terms = get_terms( array(
    'taxonomy'      => 'kategori_tapahtumat',
));


// SELECT OPTION CATEGORY
?>

    <option value="">Valitse kategoria</option>
    <?php 
    
    foreach ($terms as $term) { ?>
        <option value="<?php echo $term->slug; ?>" <?php if(isset($_GET('kat')) && $_GET('kat') == $term->slug) { echo 'selected="selected"'; }?>>
        <?php echo $term->name; ?></option>
    <?php } ?>
</select>

<?php  // SELECT OPTION MONTH ?>
<select class="form-select" name="kk">
    <option value="">Valitse kuukausi</option>
    <?php 
    for ($i = 1; $i <= 12; $i++){
    $month_name = date_i18n('F', mktime(0, 0, 0, $i, 1, 2011)); 
    $month = !empty( $_GET('kk') ) ? $_GET('kk') : 0;
    $selected = $month_name == $month;
    ?>
    <option value="<?php echo $month_name; ?>" 
    <?php if(isset($_GET('kk')) && !empty($_GET('kk')) == $selected) { echo 'selected="selected"'; }?>
    <?php $selected ?>> 
        <?php echo $month_name; ?>
    </option>
    
    <?php }?>
</select>
<input type="submit" name="" value="Valitse">
// Selected category from form option 
if($_GET('kat') && !empty($_GET('kat'))) {
    $selected_cat = $_GET('kat');
}

//Selected month from form option
if($_GET('kk') && !empty($_GET('kk'))) {
    $selected_month = $_GET('kk');  
}


$today = date('Ymd');
$m = get_the_time('m');

$args =  (
    'post_type'         => 'tapahtumat',
    'post_status'       => 'publish',
    'posts_per_page'    => - 1,
    'meta_key'          => 'aloituspaiva', //event start date
    'meta_value'        => $today,
    'orderby'           => 'meta_value',
    'value'             => $today,
    'meta_compare'      => '>=',
    'type'              => 'DATE',
    'order'             => 'ASC',
    'tax_query'         => (
        (
            'taxonomy'  => 'kategori_tapahtumat',
            'field'     => 'slug',
            'terms'     => $selected_cat, //category get from form 
        )
    ),
    'meta_query'        => (
        'relation'      => 'OR',
        (
            
            'month'     => $m,
            'value'     => $selected_month, // get from form possible?
            'compare'   => '=',
        )

    )
);
$query = new WP_Query($args);

// List events by month (default view) - using dboris solution

$all_events = ();

if($query->have_posts()) :
    while ($query->have_posts() ) : $query->the_post();
        $date = strtotime(get_post_meta( get_the_ID(), 'aloituspaiva', true ) );
        $month_year = date( "F", $date );
        $all_events( $month_year )() = $query->post;    
    endwhile;
    // Sorting events by month

    foreach ( $all_events as $month_year => $events) : ?>
        <?php echo '<br><br><strong>' . $month_year . '</strong><br>';  ?>

        <?php foreach ( $events as $event ) : ?>
            <?php echo $event->post_title . '<br>';?>
        <?php endforeach;?>
    <?php endforeach;
else :
    echo ('No results.');
endif;

wp_reset_postdata(); 

Can you Create “YouTube” category and more.

Can you create “YouTube” Category?
-Subcatories
“YouTubers”, “Review”, “SEO” and more.

I can be volunteer to manage all of the category and you can add few more people too.

Just think, DigitalPoint will have categories for top 2 search engines, Google and YouTube.
SEMrush

Please feel free to reply about my suggestion.

 

sheaf theory – Why is the ambiguity of the target category when first defining sheaves not a serious issue?

I am taking notes on (pre)sheaves of topological spaces. Some sources define them as functors to $Set$. Others as functors to $Ab$. Or sometimes $Mod_R$. Or $CRing$. They all clarify ‘our category can be replaced by others (sets, abelian groups, …)’

This kind of bothers me. In my notes, I wanted to avoid these ambiguities by just defining $C$-valued sheaves, for $C$ some category. But this got annoying pretty quickly, since we soon need to worry about whether $C$ has certain properties (i.e. direct limits).

So I am going to concede and restrict myself to functors to a specific category, keeping in mind that that category ‘can be replaced by others.’ But I want to want to say something about why this ambiguity is not a huge concern.

Unfortunately, I myself do not fully understand why this ambiguity basically gets brushed off. We can take $C=Set$ and this more-or-less allows us to formally analogize to other concrete categories. But what about non-concretizable categories? My question: is it simply the case that in practice, we end up working basically exclusively with ‘nice enough’ categories that we can not worry about the ambiguity of ‘other categories’ too much?

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies 5000 Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive.com Proxies-free.com New Proxy Lists Every Day Proxies123.com Buy Cheap Private Proxies; Best Quality USA Private Proxies