SeizeTheDay Posted November 26, 2019 Share Posted November 26, 2019 Hi everyone. There is an override codes on the term and condition page that I used in versions of prestashop 1.6.x showing buyer and seller information. Thanks to the following override file, I was able to make automatically a sales contract on the checkout page. but now I need to adapt this override codes to version 1.7.x , how can I adapt this code to the prestashop 1.7.x versions? codes for 1.6x: // override START $cart = $this->context->cart; if ($cart->id_address_delivery) { $currency = new CurrencyCore($cart->id_currency); $customer = new Customer((int)$cart->id_customer); $delivery = new Address( $cart->id_address_delivery ); $invoice = new Address( $cart->id_address_invoice); $user = $delivery->getFields(); function _getFormatedAddress(Address $the_address, $line_sep, $fields_style = array()) { return AddressFormat::generateAddress($the_address, array('avoid' => array()), $line_sep, ' ', $fields_style); }; $product_list ='<table><tr><td>Ürün Adı</td><td>Ürün Fiyatı</td><td>Adet</td><td>KDV</td>'; foreach ( $cart->getProducts() as $key=>$item ) { $price = round( $item['price'], 3 ); if ( $item['price'] > $price ) $price += 0.001; $product_list .= "<tr><td>".$item['name'].'</td>'; $product_list .= "<td>".$price.'</td> '; $product_list .= "<td>".$item['quantity'].'</td> '; $product_list .= "<td>".$item['rate']. "</td></tr>"; } $product_list .='</table>'; if (isset($this->cms)){ $this->cms->content=str_replace("{SHOP_NAME}",configuration::get('PS_SHOP_NAME'),"{$this->cms->content}"); $this->cms->content=str_replace("{CustomerName}",$customer->firstname,"{$this->cms->content}"); $this->cms->content=str_replace("{CustomerLastName}",$customer->lastname,"{$this->cms->content}"); $this->cms->content=str_replace("{CustomerEmail}",$customer->email,"{$this->cms->content}"); $this->cms->content=str_replace("{CartID}",$cart->id,"{$this->cms->content}"); $this->cms->content=str_replace("{CartTotal}",floatval(number_format($cart->getOrderTotal(true, 3), 2, '.', '')),"{$this->cms->content}"); $this->cms->content=str_replace("{CurrencyISO}",$currency->iso_code,"{$this->cms->content}"); $this->cms->content=str_replace("{Date}",gmdate('Y-m-d H:i:s'),"{$this->cms->content}"); $this->cms->content=str_replace("{delivery_block_html}",_getFormatedAddress($delivery, '<br />', array( 'firstname' => '<span style="font-weight:bold;">%s</span>', 'lastname' => '<span style="font-weight:bold;">%s</span>' )),"{$this->cms->content}"); $this->cms->content=str_replace("{invoice_block_html}",_getFormatedAddress($invoice, '<br />', array( 'firstname' => '<span style="font-weight:bold;">%s</span>', 'lastname' => '<span style="font-weight:bold;">%s</span>' )),"{$this->cms->content}"); $this->cms->content=str_replace("{Products}",$product_list,"{$this->cms->content}"); [spam-filter] // override END thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now