Page 1 of 1

Problem of updating oc2.0 to oc2.3 for a homemade code

Posted: Fri Jul 21, 2017 12:25 am
by Mirbrou
Hi,
Sorry for my English.
I update my online store from 2.0.1.1 to 2.3.0.2. In which, there are two modes of display of quantity: in decimals for meters and in integers for items. Depending on the category, the display changed. In OC2.3, the item quantities are also displayed in decimal. I do not see selling 0.25 cm of an apron:D

Here is the code of the OC2.1 version:

Code: Select all

<div class="cart">
	<div class="add-to-cart clearfix">
			          <p><label class="control-label" for="input-quantity"><?php echo $entry_qty; ?></label></p>
		<div class="quantity">
                 <?php if (($category_id=='51')or($category_id=="55")or($category_id=="109")or($category_id=="186")or($category_id=="187")or($category_id=="188")or($category_id=="189")or($category_id=="190")or($category_id=="265")or($category_id=="282")or($category_id=="283")) { ?>
                                           <input type="text" name="quantity" id="quantity_wanted" size="4" value="1" type="number" step="1" />

                                        <script>
                                          $(document).ready(function() {
                                          $("#quantity").change(function() {
                                          $(this).val(Math.ceil($(this).val()));
                                          });
                                          });
                                        </script>
                  <?php } else { ?>
                   <select id="quantity" name="quantity">
                      <option value="1.00">1 m</option>
                      <option value="0.25">0.25 m</option>
                      <option value="0.50">0.50 m</option>
                      <option value="0.75">0.75 m</option>
                      <option value="1.25">1.25 m</option>
                      <option value="1.50">1.50 m</option>
                      <option value="1.75">1.75 m</option>
                      <option value="2.00">2 m</option>
                      <option value="2.25">2.25 m</option>
                      <option value="2.50">2.50 m</option>
                      <option value="2.75">2.75 m</option>
                      <option value="3.00">3 m</option>
                      <option value="3.25">3.25 m</option>
                      <option value="3.50">3.50 m</option>
                      <option value="3.75">3.75 m</option>
                      <option value="4.00">4 m</option>
                      <option value="4.25">4.25 m</option>
                      <option value="4.50">4.50 m</option>
                      <option value="4.75">4.75 m</option>
                      <option value="5.00">5 m</option></select>
                  <?php } ?>

            </div>
			          <input type="hidden" name="product_id" size="1" value="<?php echo $product_id; ?>" />
			          &nbsp;
						<?php if($theme_options->get( 'display_add_to_cart' ) != '0' ) { ?>
							<div class="cart-holder">
								<input type="button" value="<?php if($theme_options->get( 'add_to_cart_text', $config->get( 'config_language_id' ) ) != '') { echo $theme_options->get( 'add_to_cart_text', $config->get( 'config_language_id' ) ); } else { echo 'Add to cart'; } ?>" id="button-cart" rel="<?php echo $product_id; ?>" class="button" />
								<a href="<?php echo "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>" class="button" id="button-more-details"><?php if($theme_options->get( 'more_details_text', $config->get( 'config_language_id' ) ) != '') { echo html_entity_decode($theme_options->get( 'more_details_text', $config->get( 'config_language_id' ) )); } else { echo 'More details'; } ?></a>
							</div>
						<?php } ?>

						<?php if($theme_options->get( 'display_add_to_compare' ) != '0') { ?>
							<div class="compare-holder">
								<a onclick="compare.add('<?php echo $product_id; ?>');" title="<?php if($theme_options->get( 'add_to_compare_text', $config->get( 'config_language_id' ) ) != '') { echo $theme_options->get( 'add_to_compare_text', $config->get( 'config_language_id' ) ); } else { echo 'Add to compare'; } ?>" class="fa  fa-external-link product-icon"></a>
							</div>

						<?php } ?>

						<?php if($theme_options->get( 'display_add_to_wishlist' ) != '0' ) { ?>

							<div class="wishlist-holder">
								<a onclick="wishlist.add('<?php echo $product_id; ?>');" title="<?php if($theme_options->get( 'add_to_wishlist_text', $config->get( 'config_language_id' ) ) != '') { echo $theme_options->get( 'add_to_wishlist_text', $config->get( 'config_language_id' ) ); } else { echo 'Add to wishlist'; } ?>" class="fa fa-heart-o product-icon"></a>


							</div>
						<?php } ?>

		</div>



							<?php if ($minimum > .99) { ?>
							<div class="minimum"><?php echo $text_minimum; ?></div>
							<?php } ?>
						</div>
Are there any differences in the code and in the syntax between 2.0 and 2.3?

S.v.p., help me with this problem !!

Thank you

Mireille

Re: Problem of updating oc2.0 to oc2.3 for a homemade code

Posted: Fri Jul 21, 2017 3:14 pm
by florinsith
There is no syntax difference between opencart versions, maybe now with 3.x because it uses twig. It seems like you might have forgotten about some code in that controller file that sets that category_id variable.

Re: Problem of updating oc2.0 to oc2.3 for a homemade code

Posted: Sat Jul 22, 2017 12:17 am
by Mirbrou
Thank you,

I forgot to present you the code for the controller of v2.0.1.1:

Code: Select all

			if (isset($category_id)) {
				$data['category_id'] = $category_id;
			}else{
				 $data['category_id'] = 0;
			}

Maybe my script is missing?

Code: Select all

<script>
                                          $(document).ready(function() {
                                          $("#quantity").change(function() {
                                          $(this).val(Math.ceil($(this).val()));
                                          });
                                          });
                                        </script>
If you can help me find it. I can not put v2.3 online, as long as I have not fixed this.

Than you,

Mireille