Thread: $products_name

Results 1 to 10 of 10
  1. #1
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default $products_name

    ZenCart v1.5.5e
    Apache server (Hostmatters)
    PHP 5.6.31 (Zend: 2.6.0)
    MySQL 5.6.37
    About_us page
    dbio 1.3.0
    MainImageReplacer-v1.0
    Image_Handler4_v4.3.2

    On the main product page (tpl_modules_main_product_image.php), I have a 360 view of a toy via a cluged Image Handler4. This is referenced through ZenCart's "$products_name" or the mysqlDB via ZenCart's "products_id". No problem.

    I could not get any 'EZ-Pages' to play with php properly so, I had to cluge together my own setup.

    I have a link (echo '<a href="Large360view.php">Larger 360 View</a>';) to a 'Large360view.php' file and I cannot get "$products_name" or "products_id" to come over and play, ergo I have been forced, at this time, to brute force my way to the information in 'Large360view.php' through;

    PHP Code:
    $page $_SERVER['HTTP_REFERER'];
    $ID substr($pagestrrpos($page"&products_id=")+13); 
    It is working, but it is definitely not a clean and durable line of code.

    Surly there is a better way?

    I have tried $_SERVER, $_GET, $GLOBALS, global, $SESSION, etc..

    Everything is "NULL" when I am in Large360view.php. I get nothing to follow me.

    Any help would be appreciated.

    link here
    Last edited by IATIA; 7 Aug 2017 at 12:11 PM. Reason: forgot link

  2. #2
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: $products_name

    If you have to href your way to the other software, then attach the parameters already available onto your link, which would be better generated using zen_href_link.

    Ie:
    Code:
    <a href="<?php echo zen_href_link(FILENAME_LARGE_360_VIEW, zen_get_all_get_params(), $request_type); ?>" ><?php echo TEXT_LARGER_360_VIEW; ?></a>
    With a new file in your includes/extra_defines that has a define for FILENAME_LARGE_360_VIEW to your filename.

    Then when the link is generated, it will include the get parameters that existed before clicking the link.

    If there are any expected that are also known to not be included, then add them to an array as a parameter to the zen_get_all_get_params function.

    Then, once in your php file, read the $_GET['products_id'] validating that it is set and then when using the value cast it to integer. Then can use ZC functions if you have included: includes/application_top.php above the use of the function in your file.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default Re: $products_name

    So, enter the code exactly as is and make sure FILENAME_LARGE_360_VIEW and TEXT_LARGER_360_VIEW are defined.

    (i don't know how many times i have entered code to find out i had to rewrite everything but the structure)

  4. #4
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: $products_name

    As is in "html space" meaning, the a tag is html. If using a variable to set that "line", then would need to quote and as necessary escape quotes so that they remain as desired on the page source.

    But yes, the php provided should keep what you have from the product page and make it accessible in your 360 file. I was thinking that perhaps the zenid shouldn't be passed with the other parameters, but then if a customer chose the product_info page as their landing page, the link may not have the zenid in it as would be expected for each first link. Hmm, maybe on second thought since zen_href_link evaluates the need of adding the zenid, perhaps it should be excluded. So
    zen_get_all_get_params() probably should be:
    zen_get_all_get_params(array('zenid')) unless you have some very specific need to have zenid on the get/url that won't be handled/addressed by the remainder of ZC processing...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default Re: $products_name

    I think this is going to do it. I get a status on the link. Right now, the page "Large360view.php" cannot be found. Where should it be located?

    ~Store/index.php?main_page=Large360view.php&cPath=14_15&products_id=20

  6. #6
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: $products_name

    Sorry, glad you did ask before, wish I had reviewed the zen_href_link function further.

    Need to make it a static link and the filename needs to include the extension of '.php' (without the extra single quote:
    Code:
    <?php
    define('FILENAME_LARGE_360_VIEW', 'Large360view.php');
    Then the zen_href_link call:
    Code:
    zen_href_link(FILENAME_LARGE_360_VIEW, zen_get_all_get_params(array('zenid')), $request_type, true, true, true);
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default Re: $products_name

    Got it! Thanks!

  8. #8
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default Re: $products_name

    Went from this;

    PHP Code:
    $page $_SERVER['HTTP_REFERER'];
    $ID substr($pagestrrpos($page"&products_id=")+13); 
    To this;

    PHP Code:
    $ID $_GET['products_id']; 

  9. #9
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: $products_name

    Unless you need the attribute-hash on the products_id, use this for better security:

    Code:
    $ID = (int)$_GET['products_id'];
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  10. #10
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default Re: $products_name

    Quote Originally Posted by DrByte View Post
    Unless you need the attribute-hash on the products_id, use this for better security:

    Code:
    $ID = (int)$_GET['products_id'];
    Done, Thanks!

 

 

Similar Threads

  1. question marks (?) on products_name and products_description
    By genesissystem in forum Upgrading to 1.5.x
    Replies: 8
    Last Post: 31 Jan 2013, 01:50 AM
  2. Help with $products_name
    By limelites in forum General Questions
    Replies: 3
    Last Post: 24 Jun 2009, 11:11 AM
  3. Need to include Manufacturer in orders products_name
    By stride-r in forum Managing Customers and Orders
    Replies: 0
    Last Post: 2 Feb 2009, 02:56 PM
  4. $products_name on tpl_product_reviews_default.php
    By Alex Clarke in forum General Questions
    Replies: 2
    Last Post: 19 Sep 2007, 09:50 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR