ERROR

Undefined index: id

/home/wenzelc/public_html/View/order-made.php 16

1 <?php
2
// Assets
3
$this->addAsset('modal'false);
4
$this->addAsset('css/order-confirmation');
5
$this->addAsset('css/head-checkout');
6
$this->addAsset('shopper/components/cart'false);
7
$this->addAsset('components/head'false);
8
$this->addAsset('components/checkout'false);
9
$this->addAsset('components/products');
10
$this->addAsset('components/produto-view');
11
// Controllers
12
$this->using('ShopperMethod\\Catalog');
13
$this->using("ShopperMethod\\Shopper");
14
15
16$orderObj $this->Shopper->getOrderById($_GET['id']);

17@
$orderObj->onlyView();
18
19
$order $this->Shopper->getCartOrder($_GET['id']);
20
21
22
?>
23

24
25<div class="container" id="printable" style=" max-width:900px;">
26    <div class="order-info" style="width:100%;">
27        <div class="btn-order-info"><a href="~/"><button>Voltar</button></a></div>
28        <div>
29            <!-- <img src="~public/images/svgs/icons.svg"> -->
30            <h2>Pedido Realizado!</h2>
31
32        </div>
33        <div class="btn-order-info"><button @click="print">Imprimir</button></div>
34    </div>
35    <div class="order-resume">
36        <div class="flex-container" style="flex-direction: row;align-items: center;">
37
38            <div>
39                <h3 class="order-resume-title title-16">Númedo do Pedido</h3>
40                <span class="title-16">
41                    {{order.id}}
42                </span>
43            </div>
44
45            <div>
46                <h3 class="order-resume-title  title-16">Data</h3>
47                <span class="title-16">{{orderObj.date_create | Convert('date.localDate')}}</span>
48            </div>
49
50            <div>
51                <h3 class="order-resume-title  title-16">Total</h3>
52                <span class="title-16">{{order.getTotal()}}</span>
53            </div>
54
55            <div>
56                <h3 class="order-resume-title  title-16">Forma de Pagamento</h3>
57                <span class="title-16">
58
59                    <?= $orderObj->getFinalPayment() ? $orderObj->getFinalPayment()->getMethod()->getMethod() : "-" ?>
60

61
62                </span>
63            </div>
64            <?php if ($orderObj->getFinalPayment()->getMethod()->getMethod() == 'Boleto') : ?>
65
                <div>
66
67
68                    <a class="btn" style="padding: 9px 9px;font-size:12px" href="<?= $orderObj->getFinalPayment()->getPaymentURL() ?>">
69                        Download Boleto</a>
70
71
72                </div>
73            <?php endif; ?>
74
            <?php if (!empty($orderObj->getTransport()->getTrackingURL())) : ?>
75
                <div>
76
77
78                    <a class="btn" style="padding: 9px 9px;font-size:12px" href="<?= $orderObj->getTransport()->getTrackingURL(); ?>">Rastreamento do pedido</a>
79
80                </div>
81            <?php endif; ?>
82
        </div>
83    </div>
84    <div class="detalis-order">
85        <h3 class="title-16">Detalhes do Pedido</h3>
86        <div class="detalis-order-row flex-container">
87            <span class="title-14">PRODUTO (S)</span>
88            <span class="title-14">SUBTOTAL</span>
89        </div>
90        <div class="detalis-order-row" v-for="item in order.items">
91            <div class="flex-container">
92
93
94                <span class="title-14 prices-order-confirmation" style="    align-items: flex-start;">
95
96                    <b class="body-16">
97
98
99                        {{item.quantity}} x {{item.title}}
100                    </b>
101
102
103                    <span v-if="item.attributes.length > 0 && item.attributes[0].content" class="body-12">
104
105                        <span>Caixa {{item.attributes[0].content}}</span><br>
106                      
107                    </span>
108
109
110                    <span v-if="item.ipi" class="body-12">
111
112                        <small class="body-12" v-if="item.ipi">IPI no Preço<br></small>
113                    </span>
114                    <span v-if="item.icms" class="body-12">
115
116                        <small class="body-12" v-if="item.icms">ICMS Incluso <br></small>
117                    </span>
118                    <span v-if="item.st" class="body-12">
119
120                        <small class="body-12 " v-if="item.st">ST no Preço<br></small>
121                    </span>
122                    <!-- <span class="body-12" v-if="item.valor_imposto">
123                        <small class="body-12" v-if="item.valor_imposto">Total de impostos<br></small>
124
125                    </span> -->
126
127                </span>
128
129
130                <span class="title-14 prices-order-confirmation">
131
132                    <b class="body-16">
133
134
135                        {{item.getPrice()}}
136                    </b>
137
138
139                    <span v-if="item.attributes.length > 0 && item.attributes[0].content" class="body-12">
140
141                        <br>  
142                    </span>
143
144
145                    <span v-if="item.ipi" class="body-12">
146
147                        {{ convertToCurrency(item,item.ipi)}}<br>
148                    </span>
149                    <span v-if="item.icms" class="body-12">
150
151                        {{ convertToCurrency(item,item.icms)}}<br>
152                    </span>
153                    <span v-if="item.st" class="body-12">
154
155                        {{ convertToCurrency(item,item.st)}}<br>
156                    </span>
157
158                    <!-- <span class="body-12" v-if="item.valor_imposto">
159                        {{ getTotalImpostosCurrency(item)}}
160
161                    </span> -->
162
163                </span>
164            </div>
165
166        </div>
167
168        <div class="detalis-order-row flex-container">
169            <span class="title-14">SUBTOTAL</span>
170            <span class="title-14">{{order.getSubTotal()}}</span>
171        </div>
172        <div class="detalis-order-row flex-container">
173            <span class="title-14">ST Total da Nota:</span>
174            <span class="title-14">{{getTotalImpostosOrderCurrency('st')}}</span>
175        </div>
176        <div class="detalis-order-row flex-container">
177            <span class="title-14">ICMS Total da Nota:</span>
178            <span class="title-14">{{getTotalImpostosOrderCurrency('icms')}}</span>
179        </div>
180        <div class="detalis-order-row flex-container">
181            <span class="title-14">IPI Total da Nota:</span>
182            <span class="title-14">{{getTotalImpostosOrderCurrency('ipi')}}</span>
183        </div>
184        <div class="detalis-order-row flex-container">
185            <span class="title-14">ENVIO</span>
186            <span class="title-14"><?= $orderObj->getTransport()->getMethod()->getMethod(); ?></span>
187
188        </div>
189        <div class="detalis-order-row flex-container">
190
191            <span class="title-14">FRETE</span>
192            <span class="title-14">{{Convert.number.currency(order.total_transport)}}</span>
193        </div>
194        <div class="detalis-order-row flex-container">
195
196            <span class="title-14">ENDEREÇO</span>
197            <span class="title-14"><?=$orderObj->getDeliveryAddress()->get()['title'].' '
198                
.$orderObj->getDeliveryAddress()->get()['address'].', '$orderObj->getDeliveryAddress()->get()['number'] .' - '.
199                
$orderObj->getDeliveryAddress()->get()['district'] .' '.  $orderObj->getDeliveryAddress()->get()['city'] . ' - ' .$orderObj->getDeliveryAddress()->get()['state']
200                .
' '.  $orderObj->getDeliveryAddress()->get()['complement']
201                
?></span>
202        </div>
203        <div class="detalis-order-row flex-container">
204            <span class="title-14">FORMA DE PAGAMENTO</span>
205            <span class="title-14"><?= $orderObj->getFinalPayment() ? $orderObj->getFinalPayment()->getMethod()->getMethod() : "-" ?></span>
206        </div>
207
208
209        <div class="detalis-order-row flex-container">
210            <span class="title-14">DESCONTOS
211
212                <ul class="sacola-main-coupons-list">
213                    <template v-for="coupon in order.discounts">
214                        <li class="body-14 flex-container" style="justify-content: space-between;">
215                            <span class="body-12" v-text="coupon.title"></span>
216                            <span class="flex-container body-12">
217                                - <span v-text="coupon.getAmount()"></span>
218                            </span>
219                        </li>
220                    </template>
221                </ul>
222            </span>
223
224            <span class="title-14">- {{order.getTotalDiscount()}}</span>
225        </div>
226        <div class="detalis-order-row flex-container">
227            <span class="title-14">TOTAL</span>
228            <span class="title-14">{{order.getTotal()}}</span>
229        </div>
230
231    </div>
232
233    <div class="flex-container order-mode-btn">
234        <span></span>
235        <button @click="addItemToCartInterface(true)" class="btn">REFAZER PEDIDO</button>
236    </div>
237
238</div>
239<script>
240    Vue.mixin({
241
242        data() {
243            return {
244                page: 4,
245                order: new OrderModel(<?= json_encode($order?>),
246                orderObj: new OrderModel(<?= json_encode($orderObj->get()) ?>),
247            }
248        },
249        methods: {
250            addItemToCartInterface(redirect = false) {
251                // Inicia o carregamento
252                loader(true);
253
254                items = this.order.items;
255                for (const i in items) {
256                    this.addItemToCart(items[i], resp => {
257
258                        if (resp.status != 200) {
259                            // Para o carregamento
260                            // loader(false);
261                            // Informa o erro
262                            console.log(resp.error.message)
263                            return swal.fire({
264                                icon: 'error',
265                                text: resp.error.message
266                            })
267
268                        }
269
270                        if (redirect)
271                            // Redireciona para a bag
272                            return window.location.href = `${request.u}/carrinho`
273                        // Para o carregamento
274                        loader(false);
275                        this.modalAddBag = true;
276                    });
277
278
279                }
280
281
282            },
283            convertToCurrency(item, porcentagem) {
284                return Convert.number.currency(((item.original_price / 100) * porcentagem) * item.quantity, SHOPPER_CURRENCY.label);
285            },
286
287            getTotalImpostosCurrency(item) {
288                let ipi = ((item.original_price / 100) * item.quantity) * item.ipi;
289                let icms = ((item.original_price / 100) * item.quantity) * item.icms;
290                let st = ((item.original_price / 100) * item.quantity) * item.st;
291
292                return Convert.number.currency(ipi + st, SHOPPER_CURRENCY.label);
293            },
294
295            getTotalImpostosOrderCurrency(imposto = null) {
296                let total = 0;
297
298                let ipi = 0;
299                let icms = 0;
300                let st = 0
301
302
303                this.order.items.forEach(item => {
304                        ipi += ((item.original_price / 100) * item.ipi) * item.quantity;
305                        icms += ((item.original_price / 100) * item.icms) * item.quantity;
306                        st += ((item.original_price / 100) * item.st) * item.quantity;
307                        total += (ipi + st);
308
309                    });
310
311                if (imposto == null) {
312                    return Convert.number.currency(total, SHOPPER_CURRENCY.label);
313
314                } else {
315                    if (imposto == 'ipi') {
316                        return Convert.number.currency(ipi, SHOPPER_CURRENCY.label);
317                    }
318
319                    if (imposto == 'st') {
320                        return Convert.number.currency(st, SHOPPER_CURRENCY.label);
321                    }
322
323                    if (imposto == 'icms') {
324                        return Convert.number.currency(icms, SHOPPER_CURRENCY.label);
325                    }
326                }
327
328            },
329            print() {
330                window.print()
331            }
332        },
333
334
335    });
336</script>

Error trace

You can see detailed error trace in the console.

System trace

You can see detailed error trace in the console.