バージョン選択

フォーラム

メニュー

オンライン状況

30 人のユーザが現在オンラインです。 (18 人のユーザが フォーラム を参照しています。)
登録ユーザ: 1
ゲスト: 29
eosot3377 もっと...

サイト内検索

質問 > フロント機能 > Block/cart.twigの問題

フロント機能

新規スレッドを追加する

フラット表示 前のトピック | 次のトピック
投稿者 スレッド
acxAura
投稿日時: 2022/10/12 13:34
対応状況: −−−
半人前
登録日: 2022/10/6
居住地:
投稿: 17
Re: Block/cart.twigの問題
ご回答ありがとうございます
Controller/CartController.phpにimage_routeという関数を作って、
そのreturn valueをCartServiceExtensionに作った

public function get_image_route(){
$images = ........
return $images;
}
に伝えたいですが、どうやってできるかわからないです...
伝えたら$imagesをBlock/cart.twigに{% set images = get_image_route()%}
に設定できますが...


これがCartControllerに作った関数です

$Carts = $this->cartService->getCarts();
        $doct = $this->getDoctrine()->getManager();
        $custom_images = array();
        $Custom_product = $this->customProductRepository->customProductFindByName();
        
        $Product = $doct->getRepository(Product::class)->find($Custom_product[0]->getId());
        foreach ($Carts as $Cart) {
            $items = $Cart->getCartItems();
            foreach($items as $item ){
                if($item->getProductClass()->getProduct()->getId() == $Product->getId()){
                    $custom = $item->getProductClass()->getCode();
                    
                    $custom = $doct->getRepository(CustomRing::class)->find($custom);
                    $ring = $doct->getRepository(Ring::class)->find($custom->getRingBaseId());
                    $upload_directory= $this->getParameter('uploads_directory'); 
                    $ring_shape = $ring->getRingShape();
                    $ring_type = $ring->getRingType();
                    $upload = $upload_directory.'/customRing/ring/'.$ring_shape.'/'.$ring_type.'/';
                    $images = glob($upload."*.{jpg,png,jpeg,JPG,JPEG,PNG}", GLOB_BRACE);
                    for($i=0;$i<count($images);$i++){
                        $aa = explode('save_image/', $images[$i]);
                        $images[$i] = $aa[1];
                    }
                    array_push($custom_images,$images[0]);
                }
            }
        }
        return $custom_images;


フラット表示 前のトピック | 次のトピック


題名 投稿者 日時
   Block/cart.twigの問題 acxAura 2022/10/11 18:33
     Re: Block/cart.twigの問題 nanasess 2022/10/11 23:41
       Re: Block/cart.twigの問題 acxAura 2022/10/12 0:22
         Re: Block/cart.twigの問題 nanasess 2022/10/12 12:01
         » Re: Block/cart.twigの問題 acxAura 2022/10/12 13:34
             Re: Block/cart.twigの問題 nanasess 2022/10/17 10:33

 



ログイン


EC-CUBE公式 Amazon Payプラグイン

統計情報

総メンバー数は89,423名です
総投稿数は110,086件です

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2314
5
umebius
2085
6
yuh
1819
7
h_tanaka
1652
8
red
1570
9
mcontact
1305
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
799
14 ramrun 789
15 karin 689
16 sumida 641
17
homan
633
18 DELIGHT 572
19
patapata
502
20
flealog
485


ネットショップの壺

EC-CUBEインテグレートパートナー

Copyright© EC-CUBE CO.,LTD. All Rights Reserved.