Sagepay Server & iFrame integration - php

I realise there is quite a bit on this in other posts and i am getting my teeth into those too, but i just want to clear one fundamental point up before i get into detail.
I have read in depth the integration document and i understand the principles. The iFrame is a corollary of server integration with a couple additions to the communication with the Sage server as i understand it; but that is for later. What i am completely stumped by is this php downloadable integration kit.
The document states that we just need to issue some value name pairs and I feel completely happy with that. The document also states that there are examples of the posts and the notificationURL reply posts that are needed in the integration kit.
In the integration kit i find two directories: demo and lib. Following the instructions to integrate the SQL into my dev environment I can get the demo to work. I can use it to make a purchase from their CD shop, but the calls and code to initialise the Sage are buried all around a really really complicated directory structure with loads of includes and external calls to throw you off the scent. I have looked atlots of the files and nowhere do i see any name/value pairs being passed. In the lib directory are a config file, and a constants file with lots of variable declarations and an initialisation file which presumably starts the whole thing off somehow, but just gives a blank screen in a browser. There is a folder called classes with many many files defining various classes, but no help files or useful notes.
What there is not is any explanation of what to do or any examples. So this is my question for anybody who has done this recently: Do i just need to post some value pairs to the server specified in the documentation (easy peasy), or do i need to have the sage files present on my server and initialise some objects and relevent properties within the class structure in the integration pack etc. The two are pretty much poles apart for me, particularly without any help files to navigate the classes structure.
Does anybody know which is the correct solution and where the mentioned exmples might be hiding.
Thanks for any help.

Related

PhpBB's automod like software for php

I have looked and looked all over to find a way to make something similar to PhpBB's automod system they use for their software.
I cannot seem to find anything similar to this with the whole xml find and replace code updater and mod installer.
I may just be typing in the wrong keywords in Google, but does anyone know of any system like this available before I start trying to make my own?
EDIT: I mean more like a code updater. For example find and replaces in a php file.
FIND:
?>
ADD BEFORE:
echo "this is text added before the ?>";
I realize this could be done with str_replace but there is surely a system out there that already does this reliably.
The reason that a system doesn't exist outside of phpBB is because it's an incredibly poor way to manage modifications. Your question does not make it clear what you want to gain from this, but since it is your own code, you should definitely not look to copy something so awful.
For “patching” code
If you want the ability to apply updates to your code, then you should look at handling it through version control. For instance, you could develop and test in a local git repository, and once you are happy, push the changes to the server. You have many options here from a basic update script to a fully-fledged Continuous Integration solution.
phpBB have implemented a solution for patching code on your live site via a Web interface, which has many issues with security, verifiability and maintainability among others.
For exposing “plugin” functionality
If you want the ability to register plugins in parts of your code, then you should architect your code as such to allow it to be handled easily. Wordpress, MediaWiki and other projects can help you write such a structure.

SugarCRM Code Flow

Actually i am using sugarCRM open source for my own purpose. That was developed by PHP in MVC format. I want to do some changes in existing file. I cannot modify the any code at any cost, because i cannot understand the flow of the code. In sugar CRM having many folders and files so that was difficult to understand the code flowing.
Exactly what i am expecting is, atleast one module is how is flowing with the code and what is the exact file path...
Very Big thanks in Advance...
Have you checked out the Sugar Developers website? There are tutorials and other information about developing for Sugar.
Sugar Developers website is a great source but you could also use documentation where you could find for each SugarCRM Flavor a Developer Guide, and since 6.3 an API Documentation and a Schema Documentation.
Sugar modules are in /modules but you don't want to edit these as it is not upgrade safe. To make a modification you either use or create the relevant folder in /custom/modules
Most often you will be doing metadata updates (most functionality is metadata driven) in files like editviewdefs.php, listviewdefs.php in the custom folder.
Logic hooks can go in here too, search for logic_hooks.php in the sugar documentation as it shows the way to create the metadata array to reference new PHP functions on hooks like "before_save", "after_save" and others.
Sometimes you can start the customisations in Studio (admin menu) and get examples generated in the custom folder for you.

Versioning code in two separate projects concurently with subverison

I have a need to create a library of Object Oriented PHP code that will see much reuse and aspires to be highly flexible and modular. Because of its independent nature I would like it to exist as its own SVN project.
I would like to be able to create a new web project, save it in SVN as its own separate project, and include within it the library project code as well. During this process, while coding the web application code and making commits, I may need to add a class to the library. I would like to be able to do so and commit those changes back to the libraries project code.
In light of all this I could manage the code in two ways
Commit the changes to the library back to a branch of its original base project code and make the branch name relevant to the web project I was using it with
Commit the changes to the library back to the original code, growing it in size regardless of any specific references that might exist.
I have two questions
How can I include this library project code into a new project yet not break the subversion functionality, i.e. allowing me to make changes to each project individually?
How I can keep the code synchronized? If I choose the first method of managing the library code I may want to grab changes from another branch and pull it in for use in another.
EDIT - I realize I can simply check out these projects individually and commit/update them individually as well, but then how can I include them together as a single project? To be more clear, how could I create a web project that includes the library code as a unified subversion project in consideration of the points I elaborated on above?
I think you can use svn:externals to achieve what you want. It will pull the library project into your website project and update it whenever you update your working copy. The only thing is you cannot commit back to the library in the same commit as you project as described in this question How do I checkin to local copy AND svn:externals subdirectories in one commit?.
Option #1 looks like the right way to go.
I think you should expect to keep separate branches of the API project for any of your sites that have site-specific modifications to the shared API. Of course, you don't need to create the branch upfront, just checkout the 'trunk' and make sure you branch before you commit any site-specific changes.
There are a couple of articles on branching/merging that I have used in the past that might help you out:
Streamed Lines: Branching Patterns for Parallel Software Development
MSDN Branching and Merging Primer
However, there are some aspects of your 'two questions' that are a bit confusing/concerning. Hopefully I'm misinterpretting what you've said, but keep the following in mind:
With your first question, I think you might be getting caught up on the physical location of the source code on your development machine and how your repositories will be structured (hint: treat the two separately).
In your second question, you mention specific references and it sounds like you might be thinking of making your API in some way dependent on the website source (hint: bad idea for an API).

Magento - Custom Products Ordered Report - How to Extend using "local" code pool?

I am trying to customize the Products Ordered report so that it only shows a summary of the products that have an SKU starting with XX. I have been following the tutorial at http://magentocoder.jigneshpatel.co.in/reports/create-custom-reports-in-magento-admin/ to extend the module, but this tutorial shows how to extend the report by adding code to the "core" code pool, which will cause problems further down the road. I have been unable to get the modifications to work using the "local" code pool, because of the confusing nature of the Magento configuration files...
Has anyone successfully extended this (or a similar) report by making the modifications in the "local" code pool? There doesn't seem to be much in terms of documentation or tutorials surrounding this topic, which I find surprising.
Any help is greatly appreciated.
The simplest way is to copy the folder/file structure from /core downwards and recreate the bit you want inside /local - so app/code/local/Mage/Adminhtml/Block ... etc.
This works for PHP files, the local folder comes first in the include path so files there will be preferred over core, but I'm not sure about the config.xml...I think it would be fine though (you'd need the whole file, with your additions, as it won't read the core version at all).
This will leave core files intact, but if the files you've copied change in an update you'll need to take those changes and put them in your version.
Doing it as a standalone module would be possible, but is a bit hard to explain in an answer...the AW_Blog module is a good one to look at for working out what the config files do though.

How do you find the block of code you are looking for in Magento?

I have been struggling with a stupid situation. A customer has asked me to alter his 'advanced search' page to add a few options. The URL of this page is like http://www.domainname.com/index.php/catalogsearch/advanced/
This is a Magento store and I have no experience with this framework. I tried to learn it but found the learning curve too steep to gain enough knowledge to finish the project on-time.
So I first made a small PHP tool that searches in all source files for a search term and reports back te number of hits. I used this tool to look for unique strings that appear on the advanced search page. But the text is nowhere to be found!
My next attempt was looking at the database to find the string. So I exported all DB data and copied the resulting queries into my code editor and searched again, and found nothing!
This is very awkward and is driving me mad. I cannot find the block of code that outputs the advanced search options!
'ANY' help would be MUCH appreciated.
Thanks,
Majid
So far I've been using the following tactics on a local dev box - don't try this on a live store obviously!:
Turn on Template Path Hints + Block Names in System -> Config -> Developer. This will get you to the phtml file that does the final render and also the block object type that it uses. Unless you've IP limited this, every visitor will see these!
Then in the phtml files to dig further you can easily Zend_Debug::dump($var) to inspect the variable/object in question and find the object type etc.
Search in your editor or grep through /app/code directories to find which files define the object type you've just found - although as it based on Zend the correct file path can be worked out most of the time from the object class.
Also
A handy trick is to deliberately insert an error in a php/phtml file, Magento gives you a nicely formatted error screen with a call stack which is interesting reading
echo() statements in the core files normally work pretty well, in the Magento set up they don't normally trigger the html headers to be sent at the wrong time
Use an IDE like Netbeans/Eclipse/Zend studio etc and put all the Magento code into your project, the resulting phpdoc information, 'open declaration' and code assist will save you hours of searching
Spend the time to get Xdebug working on your test server with an IDE that allows you to make use of it. The easiest one I've found to setup from scratch (on a Mac) is a local Mamp install with Netbeans as the IDE - the Netbeans site will walk you through this, once you've got this working well you can forget about most of the other tricks!
These are just the things I've tried so far - more suggestions please!
I've still not found a technique to debug config problems from XML issues in the multitude of XML files that Magento uses, problems here tend to fail silently and are really hard to track down as a result + the xml documentation is awful.
The URLs in Magento tell you where the template files are for a certain module.
For example, when you're looking for catalogsearch/advanced/, all template files are location in app/design/frontend/default/your-theme/.
Look inside that folder and it should be obvious. You will have a folder called catalogsearch and inside that a folder called advanced; inside which there are two files:
form.phtml
result.phtml

Categories