active example

->manufacturer('shopware AG')
                ->tax('15', 15)
                ->category('random cat')
                ->visibility($this->ids->get('sales-channel'))
                ->build();
        }

        for ($i = 1; $i <= 15; ++$i) {
            $products[] = (new ProductBuilder($this->ids, 'product' . $i))
                ->name('Test-Product')
                ->manufacturer('test-' . $i)
                ->active(true)
                ->price(15, 10)
                ->tax('test', 15)
                ->visibility($this->ids->get('sales-channel'))
                ->build();
        }

        $productRepository->create($products, Context::createDefaultContext());

        $this->searchKeywordUpdater->update($productIds, Context::createDefaultContext());

        $this->productSearchConfigRepository->update([
            [
foreach ($taxes as $tax) {
            $price = random_int(100, 200000) / 100.0;

            shuffle($keywords);
            $name = ucfirst(implode(' ', $keywords) . ' product');

            $number = Uuid::randomHex();

            $product = (new ProductBuilder($ids$number))
                ->price($price)
                ->name($name)
                ->active(true)
                ->tax('test-' . Uuid::randomHex()$tax)
                ->visibility()
                ->build();

            $products[] = $product;

            $lineItems[] = $factory->create(['id' => $ids->get($number), 'referencedId' => $ids->get($number)]$this->salesChannelContext);
            $this->addTaxDataToSalesChannel($this->salesChannelContext, $product['tax']);
        }

        $this->productRepository->create($products, Context::createDefaultContext());

        
foreach ($taxes as $tax) {
            $price = random_int(100, 200000) / 100.0;

            shuffle($keywords);
            $name = ucfirst(implode(' ', $keywords) . ' product');

            $number = Uuid::randomHex();

            $product = (new ProductBuilder($ids$number))
                ->price($price)
                ->name($name)
                ->active(true)
                ->tax('test-' . Uuid::randomHex()$tax)
                ->visibility()
                ->build();

            $products[] = $product;

            $lineItems[] = $factory->create(['id' => $ids->get($number), 'referencedId' => $ids->get($number)]$this->salesChannelContext);
            $this->addTaxDataToSalesChannel($this->salesChannelContext, $product['tax']);
        }

        $this->productRepository->create($products, Context::createDefaultContext());

        
'countryIds' => [$countryId],
                        ],
                    ],
                ],
            ],
        ], Context::createDefaultContext());

        $this->getContainer()->get('product.repository')->create([
            (new ProductBuilder($ids, '1000'))
                ->price(10)
                ->name('Test product')
                ->active(true)
                ->visibility()
                ->build(),
        ], Context::createDefaultContext());

        $this->browser->request(
            'POST',
            '/store-api/checkout/cart/line-item',
            [],
            [],
            ['CONTENT_TYPE' => 'application/json'],
            json_encode([
                
$products = [
                // no rule = 70€                 (new ProductBuilder($ids, 'p.1'))
                    ->price(70, null, 'default', 77)
                    ->price(99, null, 'currency')
                    ->visibility(TestDefaults::SALES_CHANNEL)
                    ->build(),

                // no rule = 79€                 (new ProductBuilder($ids, 'p.2'))
                    ->active(false)
                    ->price(80)
                    ->visibility(TestDefaults::SALES_CHANNEL)
                    ->variant(
                        (new ProductBuilder($ids, 'v.2.1'))
                            ->build()
                    )
                    ->variant(
                        (new ProductBuilder($ids, 'v.2.2'))
                            ->price(79)
                            ->price(88, null, 'currency')
                            ->build()
                    )
/** * Gather the parameters passed to client JavaScript via JSON. * * @since 4.1.0 * * @return array The array to be exported to the client as JSON. */
    public function json() {
        $array                   = wp_array_slice_assoc( (array) $this, array( 'id', 'description', 'priority', 'panel', 'type', 'description_hidden' ) );
        $array['title']          = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) );
        $array['content']        = $this->get_content();
        $array['active']         = $this->active();
        $array['instanceNumber'] = $this->instance_number;

        if ( $this->panel ) {
            /* translators: &#9656; is the unicode right-pointing triangle. %s: Section title in the Customizer. */
            $array['customizeAction'] = sprintf( __( 'Customizing &#9656; %s' )esc_html( $this->manager->get_panel( $this->panel )->title ) );
        } else {
            $array['customizeAction'] = __( 'Customizing' );
        }

        return $array;
    }

    

        $product1 = (new ProductBuilder($ids, 'p1'))
            ->price(100)
            ->manufacturer('m1')
            ->variant(
                (new ProductBuilder($ids, 'v1.1'))
                    ->build()
            );

        $product2 = (new ProductBuilder($ids, 'p2'))
            ->price(200)
            ->active(false);

        $product3 = (new ProductBuilder($ids, 'p3'))
            ->price(300);

        $this->getContainer()->get('product.repository')->create([
            $product1->build(),
            $product2->build(),
            $product3->build(),
        ], Context::createDefaultContext());
    }
}
'activePanels'      => array(),
            'activeSections'    => array(),
            'activeControls'    => array(),
            'settingValidities' => $exported_setting_validities,
            'nonce'             => current_user_can( 'customize' ) ? $this->get_nonces() : array(),
            'l10n'              => $l10n,
            '_dirty'            => array_keys( $post_values ),
        );

        foreach ( $this->panels as $panel_id => $panel ) {
            if ( $panel->check_capabilities() ) {
                $settings['activePanels'][ $panel_id ] = $panel->active();
                foreach ( $panel->sections as $section_id => $section ) {
                    if ( $section->check_capabilities() ) {
                        $settings['activeSections'][ $section_id ] = $section->active();
                    }
                }
            }
        }
        foreach ( $this->sections as $id => $section ) {
            if ( $section->check_capabilities() ) {
                $settings['activeSections'][ $id ] = $section->active();
            }
        }
foreach ($taxes as $tax) {
            $price = random_int(100, 200000) / 100.0;

            shuffle($keywords);
            $name = ucfirst(implode(' ', $keywords) . ' product');

            $number = Uuid::randomHex();

            $product = (new ProductBuilder($ids$number))
                ->price($price)
                ->name($name)
                ->active(true)
                ->tax('test-' . Uuid::randomHex()$tax)
                ->visibility()
                ->build();

            $products[] = $product;

            $lineItems[] = $factory->create(['id' => $ids->get($number), 'referencedId' => $ids->get($number)]$this->salesChannelContext);
            $this->addTaxDataToSalesChannel($this->salesChannelContext, $product['tax']);
        }

        $this->productRepository->create($products, Context::createDefaultContext());

        
->price(100)
            ->visibility()
            ->manufacturer('m1')
            ->variant(
                (new ProductBuilder($this->ids, 'v1.1'))
                    ->build()
            );

        $product2 = (new ProductBuilder($this->ids, 'p2'))
            ->price(200)
            ->visibility()
            ->active(false);

        $product3 = (new ProductBuilder($this->ids, 'p3'))
            ->visibility()
            ->price(300);

        $this->getContainer()->get('product.repository')->create([
            $product1->build(),
            $product2->build(),
            $product3->build(),
        ]$this->context->getContext());
    }

    
/** * Gather the parameters passed to client JavaScript via JSON. * * @since 4.1.0 * * @return array The array to be exported to the client as JSON. */
    public function json() {
        $array                          = wp_array_slice_assoc( (array) $this, array( 'id', 'description', 'priority', 'type' ) );
        $array['title']                 = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) );
        $array['content']               = $this->get_content();
        $array['active']                = $this->active();
        $array['instanceNumber']        = $this->instance_number;
        $array['autoExpandSoleSection'] = $this->auto_expand_sole_section;
        return $array;
    }

    /** * Checks required user capabilities and whether the theme has the * feature support required by the panel. * * @since 4.0.0 * @since 5.9.0 Method was marked non-final. * * @return bool False if theme doesn't support the panel or the user doesn't have the capability. */

    public function to_json() {
        $this->json['settings'] = array();
        foreach ( $this->settings as $key => $setting ) {
            $this->json['settings'][ $key ] = $setting->id;
        }

        $this->json['type']           = $this->type;
        $this->json['priority']       = $this->priority;
        $this->json['active']         = $this->active();
        $this->json['section']        = $this->section;
        $this->json['content']        = $this->get_content();
        $this->json['label']          = $this->label;
        $this->json['description']    = $this->description;
        $this->json['instanceNumber'] = $this->instance_number;

        if ( 'dropdown-pages' === $this->type ) {
            $this->json['allow_addition'] = $this->allow_addition;
        }
    }

    
for ($i = 0; $i < $lineItemCount; ++$i) {
            $price = random_int(100, 200000) / 100.0;

            shuffle($keywords);
            $name = ucfirst(implode(' ', $keywords) . ' product');

            $number = Uuid::randomHex();

            $product = (new ProductBuilder($ids$number))
                ->price($price)
                ->name($name)
                ->active(true)
                ->tax('test-' . Uuid::randomHex(), 7)
                ->visibility()
                ->build();

            $products[] = $product;

            $lineItems[] = $factory->create(['id' => $ids->get($number), 'referencedId' => $ids->get($number)]$this->salesChannelContext);
            $this->addTaxDataToSalesChannel($this->salesChannelContext, $product['tax']);
        }

        $this->getContainer()->get('product.repository')->create($products, Context::createDefaultContext());

        

        $product1 = (new ProductBuilder($this->ids, 'p1'))
            ->price(100)
            ->manufacturer('m1')
            ->variant(
                (new ProductBuilder($this->ids, 'v1.1'))
                ->build()
            );

        $product2 = (new ProductBuilder($this->ids, 'p2'))
            ->price(200)
            ->active(false);

        $product3 = (new ProductBuilder($this->ids, 'p3'))
            ->price(300);

        $this->getContainer()->get('product.repository')->create([
            $product1->build(),
            $product2->build(),
            $product3->build(),
        ], Context::createDefaultContext());
    }

    
->price(100)
            ->visibility()
            ->manufacturer('m1')
            ->variant(
                (new ProductBuilder($this->ids, 'v1.1'))
                    ->build()
            );

        $product2 = (new ProductBuilder($this->ids, 'p2'))
            ->price(200)
            ->visibility()
            ->active(false);

        $product3 = (new ProductBuilder($this->ids, 'p3'))
            ->visibility()
            ->price(300);

        $this->getContainer()->get('product.repository')->create([
            $product1->build(),
            $product2->build(),
            $product3->build(),
        ]$this->context);
    }

    
Home | Imprint | This part of the site doesn't use cookies.