Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Addon] Modular Product Page (Bootstrap)


kymation

Recommended Posts

name content width 6 sort 20, image content width 6 sort 25, description content width 6 sort 30, 

How I managed I can get description & images alongside. Or the image appear first or the description comes after the image

 

6+6=12 the total of the page width. 30&30 means their neighbours like sales hotline & searchbox ( one will be first & you can not choose that one )

 

and where I add the core codes for the other addons in product_info? 

Like I said, the cat & the milk or the dog & the fishes, but not all.

What you made wth modular product info MUST BE CORE for ALL PAGES

You like the view button, I dont. You like the Buy Now button, I dont. That's the easy way to build shops without deleting codes.

Im tired, I stay at ebay

 

see screen shot

 

 

post-339016-0-37685300-1459114080_thumb.jpg

Link to comment
Share on other sites

You have an older version of this package. Please download the latest version (1.0.3) and use that.

 

Regards

Jim

strange, I downloaded from your signature! Now I have the 1.03 version. Thanks gonna try ( again )

Link to comment
Share on other sites

Congratulations with version 1.0.3 !

All images, prices, etc... are still there but all products are : Products not found

Disable this option (nice) no productpages anymore

Link to comment
Share on other sites

Play with the numbers and you can get most layouts to work, but not all. That is the way of modules in osCommerce. It will get better with time, but right now things are still a bit crude.

 

What other addons? Once you have changed the page to modular content, all addons on that page must be modular. Older addons must be converted to modules.

 

Deleting the descriptions from the database is the same as deleting the products. Nothing in this package touches that table, so I don't know how you managed to do that.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

well Jim, the advantage of this version is that I dont have to worried the language, layout, images, etc...beose there nothing anymore that product_info has to show.

 

everything is in the db but nothing in the shop

Edited by SpicyGirl
Link to comment
Share on other sites

Product Name product_info 120 

Price product_info 130

In Cart Button product_info 135

Product Description product_info 225

Product Image product_info 250

Product Options product_info 300

 

and this is the result : see sreenshot

 

 

 

post-339016-0-59043400-1459117732_thumb.jpg

Link to comment
Share on other sites

its a good step forwards, but I think it would be better when using, left, center, right, padding_left, marging x

In that case you can build wath you want.

 

back to your other addons, a nice option will also be, price yes/no, buton yes/no and so on.

 

Buttons, prices should be core able/disable on x page(s)

Frontpage must be one page, not devided into navigation, header, front page, footer, footer suffix.

Everything available on the whole page. I am the director of that page and decide where the navigation, header, logo, banner comes.

Whithout LIMITS, that should be THE SHOP Builder that everybody wants

Link to comment
Share on other sites

That layout can be the result if you set the widths a certain way. Change the width and things will move. Add this to your user.css:

/* For Debugging Only -- Draw a box around each content module's output */
div[class^="col-"] {
  border: 1px solid red;
}

That will show you where every module is and the width it is set to. Remove that code when you have the layout you want.

 

The content divisions are part of osCommerce. I am not in charge of osCommerce, so I won't be changing osCommerce.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I've uploaded version 1.1 to the addons area. This update contains several improvements to the product_info class. The attributes and options now use a sort_order column if it exists*, and all of the data is now in the output arrays.

 

I also fixed bugs in several modules. Thanks to every one who reported a bug.

 

*The sort order field name has to contain the string sort_order. A field name of sort_order, attributes_sort_order, or product_options_sort_order will all work. Install your favorite sort order addon in the admin and this page will pick it up.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hello,

 

While I'm developing I active this:

  error_reporting(E_ALL);

...and the product_info.php of a product with special price throws:

Notice: Undefined variable: new_price in [...]includes/modules/content/product_info/cm_pi_price.php on line 41

The line is:

$products_price = '<del>' . $currencies->display_price( $product_info->products_price(), tep_get_tax_rate( $product_info->products_tax_class_id() )) . '</del> <span class="productSpecialPrice" itemprop="price" content="' . preg_replace('/[^0-9.]*/', '', $currencies->display_price($new_price, tep_get_tax_rate($product_info->products_tax_class_id() ))) . '">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info->products_tax_class_id() )) . '</span>';

Replacing $new_price with $product_info->special_price() solves it.

 

For performance, I suggest this change on product_info class, using the unused class public variable $new_price:

public function special_price() {
    if ($this->new_price === null) {
        $this->new_price = tep_get_products_special_price($this->product_info['products_id']);
    }
    return $this->new_price;
}

Thanks a lot for your usefull module!

Edited by katapofatico
Link to comment
Share on other sites

That's a bug. Thanks for telling me; I'll fix that and upload a new version.

 

The stock function tep_get_products_special_price() is actually not good to use anyway, as that function does its own database call to retrieve data. I prefer to have all of that in the class itself. I need to fix that.

 

I don't see any use for $product_info->new_price since $product_info->special_price() does the same thing. I'm open to arguments in favor of saving it, if you think there is a good use for the value.

 

My idea of the code:

    public function special_price() {
      $special_price_query_raw = "
        select 
          specials_new_products_price 
        from 
          " . TABLE_SPECIALS . " 
        where 
          products_id = '" . $this->products_id . "' 
          and status = 1";
      $special_price_query = tep_db_query($special_price_query_raw );
      $special_price_array = tep_db_fetch_array( $special_price_query );

      return $special_price_array['specials_new_products_price'];
    }

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

  • 2 weeks later...

@@kymation ok, then:

a ) use your inner query

b )  and cache the result (avoiding unnecessary queries) in instance attribute $new_price

c ) I have added LIMIT 1 because products_id is not PRIMARY_KEY nor UNIQUE, only INDEX. What do you think about this?

public function special_price() {
     if ($this->new_price === null) {
        $special_price_query_raw = "
          select 
            specials_new_products_price 
          from 
            " . TABLE_SPECIALS . " 
          where 
            products_id = '" . $this->products_id . "' 
            and status = 1 LIMIT 1";
        $special_price_query = tep_db_query($special_price_query_raw );
        $special_price_array = tep_db_fetch_array( $special_price_query );
        $this->new_price = $special_price_array['specials_new_products_price'];
     }
      return $this->new_price;
    }
Edited by katapofatico
Link to comment
Share on other sites

The specials table should have only one entry with a status ID of 1 for each product ID. Adding the limit 1 does no harm, but I don't see it doing any good. Do you have any examples or other information showing a need for this?

 

The product info class already has all of those improvements, with the exception of the GTIN. Same with all of the modules. Of course it will need to be updated to handle any new changes. The class can also be extended to handle fields that are not in the stock osCommerce build. I don't see a problem with this.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

  • 2 weeks later...

The specials table should have only one entry with a status ID of 1 for each product ID. Adding the limit 1 does no harm, but I don't see it doing any good. Do you have any examples or other information showing a need for this?

 

Ok, the core PHP code is avoiding duplicated product_id on specials table, but no specials table himself: in this situations I use LIMIT 1 or I define the DBB field as UNIQUE. I want to avoid full scanning of tables... I don't know specifically if this problem occurs with this query :)

 

 

The product info class already has all of those improvements, with the exception of the GTIN.

I don't see caching improvements on http://addons.oscommerce.com/info/9453 :

public function special_price() {
      return tep_get_products_special_price($this->product_info['products_id']);
    }

...therefore on cm_pi_price.php we will query 3 times on a product with special price:

if ($product_info->has_special_price() === true) { // THIS CALL TO products_price()
          // HERE 2 CALLS MORE:
          $products_price = '<del>' . $currencies->display_price( $product_info->products_price(), tep_get_tax_rate( $product_info->products_tax_class_id() )) . '</del> <span class="productSpecialPrice" itemprop="price" content="' . preg_replace('/[^0-9.]*/', '', $currencies->display_price($new_price, tep_get_tax_rate($product_info->products_tax_class_id() ))) . '">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info->products_tax_class_id() )) . '</span>';
        } else {
[...]
Link to comment
Share on other sites

So the Limit 1 would make the query faster by stopping after it finds the first match. That would be worth doing for cases where that table is very large. Good point!

 

The latest version does not call tep_get_products_special_price(), it does the database call directly. This is probably a good place to add a Limit 1 as well. I could probably improve this slightly by using a temporary variable. I also suspect that the improvement would be impossible to detect on a modern server. Oh well, best practices and all that.

 

Thanks for the suggestions.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

So the Limit 1 would make the query faster by stopping after it finds the first match. That would be worth doing for cases where that table is very large. Good point!

Yeah! That is the key

[...]The latest version does not call tep_get_products_special_price(), it does the database call directly.[...]

 

Excuse me, but are you reffering to a new version not yet published, aren't you? Because version 1.1 (http://addons.oscommerce.com/info/9453) from 5/April/2016 calls to tep_get_products_special_price().

 

[...] Oh well, best practices and all that.[...]

 

Yes, I always implement OOP and general best practices: I wonder when somebody ask for reasons, advantages, justifications, etc. about it. I think best prastices have a lot of benefits to performance, reusability, manteinability, etc.: Predictable and not predictable benefits. My criteria is: First I implement them, later I suspect about them: not the reverse: First suspect, later implement them. Best practices and design patterns are more inteligent that me, because they are historically condensed programming experiences.

 

I like that you like it ;)

Link to comment
Share on other sites

  • 1 month later...

the special price seems OK using @@katapofatico 's suggestion at the first place .. thanks..

 

one thing that still missing is the product tittle.. seems like these module make the Product Tittle module on header tags does not works... so when I show product page we cannot see product name on a tittle at a browser tag

 

Is there any solution for this?

 

rgds

pit

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...