www.webdeveloper.com
Results 1 to 7 of 7

Thread: Help to find area in code for specific function

  1. #1
    Join Date
    Jun 2014
    Posts
    2

    Help to find area in code for specific function

    Hi,

    I have a Calendar for a web page which works out payments and frequency of payments, last payment date etc., then finally shows a date 2 days after the last payment as a delivery date.

    I want to change this to 14 days but can't find where in the script this would be.

    I have attached a cart.tpl text file which I think is the code which works it Calculator.jpgout. I also attach an image of what I mean.

    Thanks in anticipation.

    oz
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2005
    Posts
    369
    I may be wrong, but line 128 seems to be pulling that in through an AJAX call to your server...

  3. #3
    Join Date
    Jun 2014
    Posts
    2
    Quote Originally Posted by omnicity View Post
    I may be wrong, but line 128 seems to be pulling that in through an AJAX call to your server...

    Thank you, I'll take a look at that route..

  4. #4
    Join Date
    May 2014
    Posts
    1,051
    omnicity has it right, it's being pulled via AJAX -- specifically from this file:

    index.php?route=laybuy/laybuy

    So that's what you need to track down.

    Side note though, that's a poster child for everything wrong with opening and closing PHP tags for NOTHING.

    Take just this train wreck in the head:
    Code:
    <?php echo $header; ?>
    <?php if ($attention) { ?>
    <div class="attention"><?php echo $attention; ?><img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>
    <?php } ?>
    <?php if ($success) { ?>
    <div class="success"><?php echo $success; ?><img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>
    <?php } ?>
    <?php if ($error_warning) { ?>
    <div class="warning"><?php echo $error_warning; ?><img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>
    <?php } ?>
    <?php echo $column_left; ?><?php echo $column_right; ?>
    <?php echo $column_left; ?><?php echo $column_right; ?>
    <div id="content"><?php echo $content_top; ?>
      <div class="breadcrumb">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
        <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
        <?php } ?>
      </div>
    Mein gott... There is NO reason for that to be more than:

    Code:
    <?php
    	echo $header;
    	
    	if ($attention) echo '
    		<div class="attention">
    			', $attention, '
    			<img src="catalog/view/theme/default/image/close.png" alt="" class="close" />
    		</div>';
    		
    	if ($success) echo '
    		<div class="success">
    			', $success, '
    			<img src="catalog/view/theme/default/image/close.png" alt="" class="close" />
    		</div>';
    		
    	if ($error_warning) echo '
    		<div class="warning">
    			', $error_warning, '
    			<img src="catalog/view/theme/default/image/close.png" alt="" class="close" />
    		</div>';
    		
    	echo $column_left, $column_right, '
    		<div id="content">
    			', $content_top, '
    			<div class="breadcrumb">';
    			
    	foreach ($breadcrumbs as $breadcrumb) echo 
    		$breadcrumb['separator'],
    		'<a href="', $breadcrumb['href'], '">
    			', $breadcrumb['text'], '
    		</a>';
    	
    	echo '
    		</div>';	
    ?>
    NOT that I'd have massive content blocks stored in global strings... memory footprint of that must be a nightmare.

    I see people use PHP that way, and don't understand why they make things so much more difficult for no reason... but then there's a reason I think the PHP 'tags' of <?php <?= <? and ?> should be removed from the language.
    Java is to JavaScript as Ham is to Hamburger.

  5. #5
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,366
    The cart script appears to be incomplete as there are variables that are used yet not defined.

    As for the query made by the OP, see previous comment about AJAX

    IMHO you might want to ask in the JavaScript Frameworks firm because the cart is reliant on JQuery which is a framework and not JavaScript.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  6. #6
    Join Date
    May 2014
    Posts
    1,051
    Quote Originally Posted by \\.\ View Post
    IMHO you might want to ask in the JavaScript Frameworks firm because the cart is reliant on JQuery which is a framework and not JavaScript.
    Might be better off in general programming -- it's got flat .js, jQuerytardery, AND server-side code in the form of PHP on this one.

    ... and in this case the value is coming from his index.php, so it's not a jQuery issue, or a JS issue, it's a PHP issue!

    Really getting on people's cases about that is kinda strange in this day and age, the various technologies are so reliant on each-other what starts out in one language quickly leads to another.
    Last edited by deathshadow; 07-04-2014 at 05:59 AM.
    Java is to JavaScript as Ham is to Hamburger.

  7. #7
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,366
    Its a bit of everything but on the surface its a JQuery AJAX call that is retrieving the data.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles