ERROR

Undefined index: id

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

Error trace

You can see detailed error trace in the console.

System trace

You can see detailed error trace in the console.