├── .gitignore ├── AUTHORS ├── LICENCE ├── README.md ├── shell ├── apiStress.php ├── betterIndexer.php ├── changeOrderStatus.php ├── cleanCache.php ├── magentoCleanup.php └── testObserver.php └── sql ├── clean_db.sql ├── createProductsProcedure.sql ├── create_admin_community1.5+.sql ├── create_admin_enterprise1.1+.sql ├── disableCategory.sql ├── disableProducts.sql ├── getParents.sql ├── localEnv.sql ├── magento-1.9.1.0.mwb └── obfuscateUsers.sql /.gitignore: -------------------------------------------------------------------------------- 1 | app/code/community/Find/ 2 | app/code/community/Phoenix/ 3 | app/code/core/ 4 | app/design/adminhtml/default/default/ 5 | app/design/adminhtml/default/find/ 6 | app/design/frontend/base/ 7 | app/design/frontend/default/blank/ 8 | app/design/frontend/default/default/ 9 | app/design/frontend/default/iphone/ 10 | app/design/frontend/default/modern/ 11 | app/design/install/ 12 | app/etc/modules/Find_Feed.xml 13 | app/etc/modules/Mage_All.xml 14 | app/etc/modules/Mage_Api.xml 15 | app/etc/modules/Mage_Authorizenet.xml 16 | app/etc/modules/Mage_Bundle.xml 17 | app/etc/modules/Mage_Centinel.xml 18 | app/etc/modules/Mage_Compiler.xml 19 | app/etc/modules/Mage_Connect.xml 20 | app/etc/modules/Mage_Downloadable.xml 21 | app/etc/modules/Mage_ImportExport.xml 22 | app/etc/modules/Mage_PageCache.xml 23 | app/etc/modules/Mage_Persistent.xml 24 | app/etc/modules/Mage_Weee.xml 25 | app/etc/modules/Mage_Widget.xml 26 | app/etc/modules/Mage_XmlConnect.xml 27 | app/etc/modules/Phoenix_Moneybookers.xml 28 | app/etc/config.xml 29 | app/etc/local.xml.additional 30 | app/etc/local.xml.template 31 | app/.htaccess 32 | app/locale/en_US/ 33 | app/Mage.php 34 | cron.php 35 | cron.sh 36 | downloader/ 37 | errors/ 38 | favicon.ico 39 | get.php 40 | includes/ 41 | index.php 42 | index.php.sample 43 | install.php 44 | js/blank.html 45 | js/calendar/ 46 | js/extjs/ 47 | js/flash/ 48 | js/index.php 49 | js/jscolor/ 50 | js/lib/ 51 | js/mage/ 52 | js/prototype/ 53 | js/scriptaculous/ 54 | js/spacer.gif 55 | js/tiny_mce/ 56 | js/varien/ 57 | lib/3Dsecure/ 58 | lib/flex/ 59 | lib/googlecheckout/ 60 | lib/.htaccess 61 | lib/LinLibertineFont/ 62 | lib/Mage/ 63 | lib/PEAR/ 64 | lib/phpseclib/ 65 | lib/Varien/ 66 | lib/Zend/ 67 | LICENSE_AFL.txt 68 | LICENSE.html 69 | LICENSE.txt 70 | mage 71 | media/customer/ 72 | media/downloadable/ 73 | media/.htaccess 74 | media/import/ 75 | media/xmlconnect/ 76 | nbproject/ 77 | pear 78 | pear/ 79 | php.ini.sample 80 | pkginfo/ 81 | RELEASE_NOTES.txt 82 | shell/abstract.php 83 | shell/compiler.php 84 | shell/indexer.php 85 | shell/log.php 86 | skin/adminhtml/default/default/ 87 | skin/frontend/base/ 88 | skin/frontend/default/blank/ 89 | skin/frontend/default/blue/ 90 | skin/frontend/default/default/ 91 | skin/frontend/default/french/ 92 | skin/frontend/default/german/ 93 | skin/frontend/default/iphone/ 94 | skin/frontend/default/modern/ 95 | skin/install/ 96 | var/ -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Andrea De Pirro -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 2.1, February 1999 3 | 4 | Copyright (C) 1991, 1999 Free Software Foundation, Inc. 5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | [This is the first released version of the Lesser GPL. It also counts 10 | as the successor of the GNU Library Public License, version 2, hence 11 | the version number 2.1.] 12 | 13 | Preamble 14 | 15 | The licenses for most software are designed to take away your 16 | freedom to share and change it. By contrast, the GNU General Public 17 | Licenses are intended to guarantee your freedom to share and change 18 | free software--to make sure the software is free for all its users. 19 | 20 | This license, the Lesser General Public License, applies to some 21 | specially designated software packages--typically libraries--of the 22 | Free Software Foundation and other authors who decide to use it. You 23 | can use it too, but we suggest you first think carefully about whether 24 | this license or the ordinary General Public License is the better 25 | strategy to use in any particular case, based on the explanations below. 26 | 27 | When we speak of free software, we are referring to freedom of use, 28 | not price. Our General Public Licenses are designed to make sure that 29 | you have the freedom to distribute copies of free software (and charge 30 | for this service if you wish); that you receive source code or can get 31 | it if you want it; that you can change the software and use pieces of 32 | it in new free programs; and that you are informed that you can do 33 | these things. 34 | 35 | To protect your rights, we need to make restrictions that forbid 36 | distributors to deny you these rights or to ask you to surrender these 37 | rights. These restrictions translate to certain responsibilities for 38 | you if you distribute copies of the library or if you modify it. 39 | 40 | For example, if you distribute copies of the library, whether gratis 41 | or for a fee, you must give the recipients all the rights that we gave 42 | you. You must make sure that they, too, receive or can get the source 43 | code. If you link other code with the library, you must provide 44 | complete object files to the recipients, so that they can relink them 45 | with the library after making changes to the library and recompiling 46 | it. And you must show them these terms so they know their rights. 47 | 48 | We protect your rights with a two-step method: (1) we copyright the 49 | library, and (2) we offer you this license, which gives you legal 50 | permission to copy, distribute and/or modify the library. 51 | 52 | To protect each distributor, we want to make it very clear that 53 | there is no warranty for the free library. Also, if the library is 54 | modified by someone else and passed on, the recipients should know 55 | that what they have is not the original version, so that the original 56 | author's reputation will not be affected by problems that might be 57 | introduced by others. 58 | 59 | Finally, software patents pose a constant threat to the existence of 60 | any free program. We wish to make sure that a company cannot 61 | effectively restrict the users of a free program by obtaining a 62 | restrictive license from a patent holder. Therefore, we insist that 63 | any patent license obtained for a version of the library must be 64 | consistent with the full freedom of use specified in this license. 65 | 66 | Most GNU software, including some libraries, is covered by the 67 | ordinary GNU General Public License. This license, the GNU Lesser 68 | General Public License, applies to certain designated libraries, and 69 | is quite different from the ordinary General Public License. We use 70 | this license for certain libraries in order to permit linking those 71 | libraries into non-free programs. 72 | 73 | When a program is linked with a library, whether statically or using 74 | a shared library, the combination of the two is legally speaking a 75 | combined work, a derivative of the original library. The ordinary 76 | General Public License therefore permits such linking only if the 77 | entire combination fits its criteria of freedom. The Lesser General 78 | Public License permits more lax criteria for linking other code with 79 | the library. 80 | 81 | We call this license the "Lesser" General Public License because it 82 | does Less to protect the user's freedom than the ordinary General 83 | Public License. It also provides other free software developers Less 84 | of an advantage over competing non-free programs. These disadvantages 85 | are the reason we use the ordinary General Public License for many 86 | libraries. However, the Lesser license provides advantages in certain 87 | special circumstances. 88 | 89 | For example, on rare occasions, there may be a special need to 90 | encourage the widest possible use of a certain library, so that it becomes 91 | a de-facto standard. To achieve this, non-free programs must be 92 | allowed to use the library. A more frequent case is that a free 93 | library does the same job as widely used non-free libraries. In this 94 | case, there is little to gain by limiting the free library to free 95 | software only, so we use the Lesser General Public License. 96 | 97 | In other cases, permission to use a particular library in non-free 98 | programs enables a greater number of people to use a large body of 99 | free software. For example, permission to use the GNU C Library in 100 | non-free programs enables many more people to use the whole GNU 101 | operating system, as well as its variant, the GNU/Linux operating 102 | system. 103 | 104 | Although the Lesser General Public License is Less protective of the 105 | users' freedom, it does ensure that the user of a program that is 106 | linked with the Library has the freedom and the wherewithal to run 107 | that program using a modified version of the Library. 108 | 109 | The precise terms and conditions for copying, distribution and 110 | modification follow. Pay close attention to the difference between a 111 | "work based on the library" and a "work that uses the library". The 112 | former contains code derived from the library, whereas the latter must 113 | be combined with the library in order to run. 114 | 115 | GNU LESSER GENERAL PUBLIC LICENSE 116 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 117 | 118 | 0. This License Agreement applies to any software library or other 119 | program which contains a notice placed by the copyright holder or 120 | other authorized party saying it may be distributed under the terms of 121 | this Lesser General Public License (also called "this License"). 122 | Each licensee is addressed as "you". 123 | 124 | A "library" means a collection of software functions and/or data 125 | prepared so as to be conveniently linked with application programs 126 | (which use some of those functions and data) to form executables. 127 | 128 | The "Library", below, refers to any such software library or work 129 | which has been distributed under these terms. A "work based on the 130 | Library" means either the Library or any derivative work under 131 | copyright law: that is to say, a work containing the Library or a 132 | portion of it, either verbatim or with modifications and/or translated 133 | straightforwardly into another language. (Hereinafter, translation is 134 | included without limitation in the term "modification".) 135 | 136 | "Source code" for a work means the preferred form of the work for 137 | making modifications to it. For a library, complete source code means 138 | all the source code for all modules it contains, plus any associated 139 | interface definition files, plus the scripts used to control compilation 140 | and installation of the library. 141 | 142 | Activities other than copying, distribution and modification are not 143 | covered by this License; they are outside its scope. The act of 144 | running a program using the Library is not restricted, and output from 145 | such a program is covered only if its contents constitute a work based 146 | on the Library (independent of the use of the Library in a tool for 147 | writing it). Whether that is true depends on what the Library does 148 | and what the program that uses the Library does. 149 | 150 | 1. You may copy and distribute verbatim copies of the Library's 151 | complete source code as you receive it, in any medium, provided that 152 | you conspicuously and appropriately publish on each copy an 153 | appropriate copyright notice and disclaimer of warranty; keep intact 154 | all the notices that refer to this License and to the absence of any 155 | warranty; and distribute a copy of this License along with the 156 | Library. 157 | 158 | You may charge a fee for the physical act of transferring a copy, 159 | and you may at your option offer warranty protection in exchange for a 160 | fee. 161 | 162 | 2. You may modify your copy or copies of the Library or any portion 163 | of it, thus forming a work based on the Library, and copy and 164 | distribute such modifications or work under the terms of Section 1 165 | above, provided that you also meet all of these conditions: 166 | 167 | a) The modified work must itself be a software library. 168 | 169 | b) You must cause the files modified to carry prominent notices 170 | stating that you changed the files and the date of any change. 171 | 172 | c) You must cause the whole of the work to be licensed at no 173 | charge to all third parties under the terms of this License. 174 | 175 | d) If a facility in the modified Library refers to a function or a 176 | table of data to be supplied by an application program that uses 177 | the facility, other than as an argument passed when the facility 178 | is invoked, then you must make a good faith effort to ensure that, 179 | in the event an application does not supply such function or 180 | table, the facility still operates, and performs whatever part of 181 | its purpose remains meaningful. 182 | 183 | (For example, a function in a library to compute square roots has 184 | a purpose that is entirely well-defined independent of the 185 | application. Therefore, Subsection 2d requires that any 186 | application-supplied function or table used by this function must 187 | be optional: if the application does not supply it, the square 188 | root function must still compute square roots.) 189 | 190 | These requirements apply to the modified work as a whole. If 191 | identifiable sections of that work are not derived from the Library, 192 | and can be reasonably considered independent and separate works in 193 | themselves, then this License, and its terms, do not apply to those 194 | sections when you distribute them as separate works. But when you 195 | distribute the same sections as part of a whole which is a work based 196 | on the Library, the distribution of the whole must be on the terms of 197 | this License, whose permissions for other licensees extend to the 198 | entire whole, and thus to each and every part regardless of who wrote 199 | it. 200 | 201 | Thus, it is not the intent of this section to claim rights or contest 202 | your rights to work written entirely by you; rather, the intent is to 203 | exercise the right to control the distribution of derivative or 204 | collective works based on the Library. 205 | 206 | In addition, mere aggregation of another work not based on the Library 207 | with the Library (or with a work based on the Library) on a volume of 208 | a storage or distribution medium does not bring the other work under 209 | the scope of this License. 210 | 211 | 3. You may opt to apply the terms of the ordinary GNU General Public 212 | License instead of this License to a given copy of the Library. To do 213 | this, you must alter all the notices that refer to this License, so 214 | that they refer to the ordinary GNU General Public License, version 2, 215 | instead of to this License. (If a newer version than version 2 of the 216 | ordinary GNU General Public License has appeared, then you can specify 217 | that version instead if you wish.) Do not make any other change in 218 | these notices. 219 | 220 | Once this change is made in a given copy, it is irreversible for 221 | that copy, so the ordinary GNU General Public License applies to all 222 | subsequent copies and derivative works made from that copy. 223 | 224 | This option is useful when you wish to copy part of the code of 225 | the Library into a program that is not a library. 226 | 227 | 4. You may copy and distribute the Library (or a portion or 228 | derivative of it, under Section 2) in object code or executable form 229 | under the terms of Sections 1 and 2 above provided that you accompany 230 | it with the complete corresponding machine-readable source code, which 231 | must be distributed under the terms of Sections 1 and 2 above on a 232 | medium customarily used for software interchange. 233 | 234 | If distribution of object code is made by offering access to copy 235 | from a designated place, then offering equivalent access to copy the 236 | source code from the same place satisfies the requirement to 237 | distribute the source code, even though third parties are not 238 | compelled to copy the source along with the object code. 239 | 240 | 5. A program that contains no derivative of any portion of the 241 | Library, but is designed to work with the Library by being compiled or 242 | linked with it, is called a "work that uses the Library". Such a 243 | work, in isolation, is not a derivative work of the Library, and 244 | therefore falls outside the scope of this License. 245 | 246 | However, linking a "work that uses the Library" with the Library 247 | creates an executable that is a derivative of the Library (because it 248 | contains portions of the Library), rather than a "work that uses the 249 | library". The executable is therefore covered by this License. 250 | Section 6 states terms for distribution of such executables. 251 | 252 | When a "work that uses the Library" uses material from a header file 253 | that is part of the Library, the object code for the work may be a 254 | derivative work of the Library even though the source code is not. 255 | Whether this is true is especially significant if the work can be 256 | linked without the Library, or if the work is itself a library. The 257 | threshold for this to be true is not precisely defined by law. 258 | 259 | If such an object file uses only numerical parameters, data 260 | structure layouts and accessors, and small macros and small inline 261 | functions (ten lines or less in length), then the use of the object 262 | file is unrestricted, regardless of whether it is legally a derivative 263 | work. (Executables containing this object code plus portions of the 264 | Library will still fall under Section 6.) 265 | 266 | Otherwise, if the work is a derivative of the Library, you may 267 | distribute the object code for the work under the terms of Section 6. 268 | Any executables containing that work also fall under Section 6, 269 | whether or not they are linked directly with the Library itself. 270 | 271 | 6. As an exception to the Sections above, you may also combine or 272 | link a "work that uses the Library" with the Library to produce a 273 | work containing portions of the Library, and distribute that work 274 | under terms of your choice, provided that the terms permit 275 | modification of the work for the customer's own use and reverse 276 | engineering for debugging such modifications. 277 | 278 | You must give prominent notice with each copy of the work that the 279 | Library is used in it and that the Library and its use are covered by 280 | this License. You must supply a copy of this License. If the work 281 | during execution displays copyright notices, you must include the 282 | copyright notice for the Library among them, as well as a reference 283 | directing the user to the copy of this License. Also, you must do one 284 | of these things: 285 | 286 | a) Accompany the work with the complete corresponding 287 | machine-readable source code for the Library including whatever 288 | changes were used in the work (which must be distributed under 289 | Sections 1 and 2 above); and, if the work is an executable linked 290 | with the Library, with the complete machine-readable "work that 291 | uses the Library", as object code and/or source code, so that the 292 | user can modify the Library and then relink to produce a modified 293 | executable containing the modified Library. (It is understood 294 | that the user who changes the contents of definitions files in the 295 | Library will not necessarily be able to recompile the application 296 | to use the modified definitions.) 297 | 298 | b) Use a suitable shared library mechanism for linking with the 299 | Library. A suitable mechanism is one that (1) uses at run time a 300 | copy of the library already present on the user's computer system, 301 | rather than copying library functions into the executable, and (2) 302 | will operate properly with a modified version of the library, if 303 | the user installs one, as long as the modified version is 304 | interface-compatible with the version that the work was made with. 305 | 306 | c) Accompany the work with a written offer, valid for at 307 | least three years, to give the same user the materials 308 | specified in Subsection 6a, above, for a charge no more 309 | than the cost of performing this distribution. 310 | 311 | d) If distribution of the work is made by offering access to copy 312 | from a designated place, offer equivalent access to copy the above 313 | specified materials from the same place. 314 | 315 | e) Verify that the user has already received a copy of these 316 | materials or that you have already sent this user a copy. 317 | 318 | For an executable, the required form of the "work that uses the 319 | Library" must include any data and utility programs needed for 320 | reproducing the executable from it. However, as a special exception, 321 | the materials to be distributed need not include anything that is 322 | normally distributed (in either source or binary form) with the major 323 | components (compiler, kernel, and so on) of the operating system on 324 | which the executable runs, unless that component itself accompanies 325 | the executable. 326 | 327 | It may happen that this requirement contradicts the license 328 | restrictions of other proprietary libraries that do not normally 329 | accompany the operating system. Such a contradiction means you cannot 330 | use both them and the Library together in an executable that you 331 | distribute. 332 | 333 | 7. You may place library facilities that are a work based on the 334 | Library side-by-side in a single library together with other library 335 | facilities not covered by this License, and distribute such a combined 336 | library, provided that the separate distribution of the work based on 337 | the Library and of the other library facilities is otherwise 338 | permitted, and provided that you do these two things: 339 | 340 | a) Accompany the combined library with a copy of the same work 341 | based on the Library, uncombined with any other library 342 | facilities. This must be distributed under the terms of the 343 | Sections above. 344 | 345 | b) Give prominent notice with the combined library of the fact 346 | that part of it is a work based on the Library, and explaining 347 | where to find the accompanying uncombined form of the same work. 348 | 349 | 8. You may not copy, modify, sublicense, link with, or distribute 350 | the Library except as expressly provided under this License. Any 351 | attempt otherwise to copy, modify, sublicense, link with, or 352 | distribute the Library is void, and will automatically terminate your 353 | rights under this License. However, parties who have received copies, 354 | or rights, from you under this License will not have their licenses 355 | terminated so long as such parties remain in full compliance. 356 | 357 | 9. You are not required to accept this License, since you have not 358 | signed it. However, nothing else grants you permission to modify or 359 | distribute the Library or its derivative works. These actions are 360 | prohibited by law if you do not accept this License. Therefore, by 361 | modifying or distributing the Library (or any work based on the 362 | Library), you indicate your acceptance of this License to do so, and 363 | all its terms and conditions for copying, distributing or modifying 364 | the Library or works based on it. 365 | 366 | 10. Each time you redistribute the Library (or any work based on the 367 | Library), the recipient automatically receives a license from the 368 | original licensor to copy, distribute, link with or modify the Library 369 | subject to these terms and conditions. You may not impose any further 370 | restrictions on the recipients' exercise of the rights granted herein. 371 | You are not responsible for enforcing compliance by third parties with 372 | this License. 373 | 374 | 11. If, as a consequence of a court judgment or allegation of patent 375 | infringement or for any other reason (not limited to patent issues), 376 | conditions are imposed on you (whether by court order, agreement or 377 | otherwise) that contradict the conditions of this License, they do not 378 | excuse you from the conditions of this License. If you cannot 379 | distribute so as to satisfy simultaneously your obligations under this 380 | License and any other pertinent obligations, then as a consequence you 381 | may not distribute the Library at all. For example, if a patent 382 | license would not permit royalty-free redistribution of the Library by 383 | all those who receive copies directly or indirectly through you, then 384 | the only way you could satisfy both it and this License would be to 385 | refrain entirely from distribution of the Library. 386 | 387 | If any portion of this section is held invalid or unenforceable under any 388 | particular circumstance, the balance of the section is intended to apply, 389 | and the section as a whole is intended to apply in other circumstances. 390 | 391 | It is not the purpose of this section to induce you to infringe any 392 | patents or other property right claims or to contest validity of any 393 | such claims; this section has the sole purpose of protecting the 394 | integrity of the free software distribution system which is 395 | implemented by public license practices. Many people have made 396 | generous contributions to the wide range of software distributed 397 | through that system in reliance on consistent application of that 398 | system; it is up to the author/donor to decide if he or she is willing 399 | to distribute software through any other system and a licensee cannot 400 | impose that choice. 401 | 402 | This section is intended to make thoroughly clear what is believed to 403 | be a consequence of the rest of this License. 404 | 405 | 12. If the distribution and/or use of the Library is restricted in 406 | certain countries either by patents or by copyrighted interfaces, the 407 | original copyright holder who places the Library under this License may add 408 | an explicit geographical distribution limitation excluding those countries, 409 | so that distribution is permitted only in or among countries not thus 410 | excluded. In such case, this License incorporates the limitation as if 411 | written in the body of this License. 412 | 413 | 13. The Free Software Foundation may publish revised and/or new 414 | versions of the Lesser General Public License from time to time. 415 | Such new versions will be similar in spirit to the present version, 416 | but may differ in detail to address new problems or concerns. 417 | 418 | Each version is given a distinguishing version number. If the Library 419 | specifies a version number of this License which applies to it and 420 | "any later version", you have the option of following the terms and 421 | conditions either of that version or of any later version published by 422 | the Free Software Foundation. If the Library does not specify a 423 | license version number, you may choose any version ever published by 424 | the Free Software Foundation. 425 | 426 | 14. If you wish to incorporate parts of the Library into other free 427 | programs whose distribution conditions are incompatible with these, 428 | write to the author to ask for permission. For software which is 429 | copyrighted by the Free Software Foundation, write to the Free 430 | Software Foundation; we sometimes make exceptions for this. Our 431 | decision will be guided by the two goals of preserving the free status 432 | of all derivatives of our free software and of promoting the sharing 433 | and reuse of software generally. 434 | 435 | NO WARRANTY 436 | 437 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO 438 | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 439 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR 440 | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY 441 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 442 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 443 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE 444 | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME 445 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 446 | 447 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 448 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY 449 | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU 450 | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR 451 | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 452 | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING 453 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A 454 | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF 455 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 456 | DAMAGES. 457 | 458 | END OF TERMS AND CONDITIONS 459 | 460 | How to Apply These Terms to Your New Libraries 461 | 462 | If you develop a new library, and you want it to be of the greatest 463 | possible use to the public, we recommend making it free software that 464 | everyone can redistribute and change. You can do so by permitting 465 | redistribution under these terms (or, alternatively, under the terms of the 466 | ordinary General Public License). 467 | 468 | To apply these terms, attach the following notices to the library. It is 469 | safest to attach them to the start of each source file to most effectively 470 | convey the exclusion of warranty; and each file should have at least the 471 | "copyright" line and a pointer to where the full notice is found. 472 | 473 | 474 | Copyright (C) 475 | 476 | This library is free software; you can redistribute it and/or 477 | modify it under the terms of the GNU Lesser General Public 478 | License as published by the Free Software Foundation; either 479 | version 2.1 of the License, or (at your option) any later version. 480 | 481 | This library is distributed in the hope that it will be useful, 482 | but WITHOUT ANY WARRANTY; without even the implied warranty of 483 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 484 | Lesser General Public License for more details. 485 | 486 | You should have received a copy of the GNU Lesser General Public 487 | License along with this library; if not, write to the Free Software 488 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 489 | 490 | Also add information on how to contact you by electronic and paper mail. 491 | 492 | You should also get your employer (if you work as a programmer) or your 493 | school, if any, to sign a "copyright disclaimer" for the library, if 494 | necessary. Here is a sample; alter the names: 495 | 496 | Yoyodyne, Inc., hereby disclaims all copyright interest in the 497 | library `Frob' (a library for tweaking knobs) written by James Random Hacker. 498 | 499 | , 1 April 1990 500 | Ty Coon, President of Vice 501 | 502 | That's all there is to it! -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Magento Utils 2 | 3 | A collection of snippets and scripts to simplify your life as a Magento developer. -------------------------------------------------------------------------------- /shell/apiStress.php: -------------------------------------------------------------------------------- 1 | 21 | * @version 1 22 | */ 23 | /** 24 | customer.list 25 | customer.create 26 | customer.info 27 | customer.update 28 | customer.delete 29 | customer_group.list 30 | customer_address.list 31 | customer_address.create 32 | customer_address.info 33 | customer_address.update 34 | customer_address.delete 35 | sales_order.list 36 | sales_order.info 37 | directory_country.list 38 | directory_region.list 39 | catalog_product_attribute_media.list 40 | catalog_product_link.list 41 | catalog_product_attribute.options 42 | cart.create 43 | cart_product.remove 44 | cart_product.add 45 | cart_product.list 46 | cart.info 47 | cart.totals 48 | cart.order 49 | cart.license 50 | cart_product.update 51 | cart_customer.set 52 | cart_customer.addresses 53 | cart_shipping.method 54 | cart_shipping.list 55 | cart_payment.method 56 | cart_payment.list 57 | cart_coupon.add 58 | */ 59 | $method = $_GET['method']; 60 | $url = $_SERVER['SERVER_NAME']; 61 | $proxy = new SoapClient("http://$url/api/soap/?wsdl"); 62 | $sessionId = $proxy->login('apiuser', 'apipassword'); 63 | $arrAddresses = array( 64 | array( 65 | "mode" => "shipping", 66 | "firstname" => "testFirstname", 67 | "lastname" => "testLastname", 68 | "company" => "testCompany", 69 | "street" => "testStreet", 70 | "city" => "Barcelona", 71 | "region" => "Barcelona", 72 | "postcode" => "08005", 73 | "country_id" => "ES", 74 | "telephone" => "0123456789", 75 | "fax" => "0123456789", 76 | "is_default_shipping" => 0, 77 | "is_default_billing" => 0 78 | ), 79 | array( 80 | "mode" => "billing", 81 | "firstname" => "testFirstname", 82 | "lastname" => "testLastname", 83 | "company" => "testCompany", 84 | "street" => "testStreet", 85 | "city" => "Barcelona", 86 | "region" => "Barcelona", 87 | "postcode" => "08005", 88 | "country_id" => "ES", 89 | "telephone" => "0123456789", 90 | "fax" => "0123456789", 91 | "is_default_shipping" => 0, 92 | "is_default_billing" => 0 93 | ), 94 | ); 95 | $customerAsGuest = array( 96 | "firstname" => "testFirstname", 97 | "lastname" => "testLastName", 98 | "email" => "testmail@example.org", 99 | "gender" => "male", 100 | "dob" => "10/10/80", 101 | "website_id" => "1", 102 | "store_id" => "1", 103 | "mode" => "guest" 104 | ); 105 | $productId = '9709'; 106 | //$time_start = microtime(true); 107 | switch ($method) { 108 | case 'cartcreate': // OK 109 | $shoppingCartId = $proxy->call($sessionId, 'cart.create', array('1')); 110 | var_dump($shoppingCartId); 111 | break; 112 | case 'customergrouplist': // OK 113 | $groupList = $proxy->call($sessionId, 'customer_group.list'); 114 | var_dump($groupList); 115 | break; 116 | case 'cartpaymentlist': // OK 117 | $shoppingCartId = $proxy->call($sessionId, 'cart.create', array('1')); 118 | $paymentList = $proxy->call($sessionId, "cart_payment.list", array($shoppingCartId)); 119 | var_dump($paymentList); 120 | break; 121 | case 'cartpaymentmethod': // OK 122 | $shoppingCartId = $proxy->call($sessionId, 'cart.create', array('1')); 123 | $arrProducts = array( 124 | array( 125 | "product_id" => $productId, 126 | "qty" => 1 127 | ) 128 | ); 129 | $resultCartProductAdd = $proxy->call($sessionId, "cart_product.add", array($shoppingCartId, $arrProducts)); 130 | 131 | $proxy->call($sessionId, "cart_customer.addresses", array($shoppingCartId, $arrAddresses)); 132 | $shippingMethod = 'flatrate_flatrate'; 133 | $resultShippingMethod = $proxy->call($sessionId, "cart_shipping.method", array($shoppingCartId, $shippingMethod)); 134 | $paymentMethod = array( 135 | "method" => "sermepa", 136 | "cc_type" => "VI", 137 | "cc_owner" => "Andrea Pallo", 138 | "cc_number" => "4548812049400004", 139 | "cc_exp_year" => "2012", 140 | "cc_exp_month" => "12", 141 | "cc_cid" => "123", 142 | ); 143 | $resultPaymentMethod = $proxy->call($sessionId, "cart_payment.method", array($shoppingCartId, $paymentMethod)); 144 | var_dump($resultPaymentMethod); 145 | break; 146 | case 'cartshippinglist': // OK 147 | $shoppingCartId = $proxy->call($sessionId, 'cart.create', array('1')); 148 | $proxy->call($sessionId, "cart_customer.addresses", array($shoppingCartId, $arrAddresses)); 149 | $resultShippingMethods = $proxy->call($sessionId, "cart_shipping.list", array($shoppingCartId, 1)); 150 | var_dump($resultShippingMethods); 151 | break; 152 | case 'cartshippingmethod': // OK 153 | $shoppingCartId = $proxy->call($sessionId, 'cart.create', array('1')); 154 | 155 | $proxy->call($sessionId, "cart_customer.addresses", array($shoppingCartId, $arrAddresses)); 156 | $shippingMethod = 'flatrate_flatrate'; 157 | $resultShippingMethod = $proxy->call($sessionId, "cart_shipping.method", array($shoppingCartId, $shippingMethod)); 158 | var_dump($resultShippingMethod); 159 | break; 160 | case 'cartcouponadd': // OK 161 | $shoppingCartId = $proxy->call($sessionId, 'cart.create', array('1')); 162 | $arrProducts = array( 163 | array( 164 | "product_id" => $productId, 165 | "qty" => 1 166 | ) 167 | ); 168 | $resultCartProductAdd = $proxy->call($sessionId, "cart_product.add", array($shoppingCartId, $arrProducts)); 169 | 170 | $resultCustomerSet = $proxy->call($sessionId, 'cart_customer.set', array($shoppingCartId, $customerAsGuest)); 171 | 172 | $proxy->call($sessionId, "cart_customer.addresses", array($shoppingCartId, $arrAddresses)); 173 | $shippingMethod = 'flatrate_flatrate'; 174 | $resultShippingMethod = $proxy->call($sessionId, "cart_shipping.method", array($shoppingCartId, $shippingMethod)); 175 | $resultCartCouponAdd = $proxy->call($sessionId, "cart_coupon.add", array($shoppingCartId, 'COUPON')); 176 | var_dump($resultCartCouponAdd); 177 | break; 178 | case 'cartorder': // OK 179 | $shoppingCartId = $proxy->call($sessionId, 'cart.create', array('1')); 180 | $arrProducts = array( 181 | array( 182 | "product_id" => $productId, 183 | "qty" => 1 184 | ) 185 | ); 186 | $resultCartProductAdd = $proxy->call($sessionId, "cart_product.add", array($shoppingCartId, $arrProducts)); 187 | 188 | $proxy->call($sessionId, "cart_customer.addresses", array($shoppingCartId, $arrAddresses)); 189 | $resultShippingMethods = $proxy->call($sessionId, "cart_shipping.list", array($shoppingCartId, 1)); 190 | $shippingMethod = 'flatrate_flatrate'; 191 | $resultShippingMethod = $proxy->call($sessionId, "cart_shipping.method", array($shoppingCartId, $shippingMethod)); 192 | $paymentMethod = array( 193 | "method" => "sermepa", 194 | "cc_type" => "VI", 195 | "cc_owner" => "Andrea Pallo", 196 | "cc_number" => "4548812049400004", 197 | "cc_exp_year" => "2012", 198 | "cc_exp_month" => "12", 199 | "cc_cid" => "123", 200 | ); 201 | $shoppingCartLicenses = $proxy->call($sessionId, "cart.license", array($shoppingCartId)); 202 | 203 | $licenseForOrderCreation = null; 204 | if (count($shoppingCartLicenses)) { 205 | $licenseForOrderCreation = array(); 206 | foreach ($shoppingCartLicenses as $license) { 207 | $licenseForOrderCreation[] = $license['agreement_id']; 208 | } 209 | } 210 | $resultOrder = $proxy->call($sessionId, "cart.order", array($shoppingCartId, null, $licenseForOrderCreation, $paymentMethod)); 211 | 212 | var_dump($resultOrder); 213 | break; 214 | case 'cartcustomeraddresses': // OK 215 | $shoppingCartId = $proxy->call($sessionId, 'cart.create', array('1')); 216 | 217 | $resultCustomerAddresses = $proxy->call($sessionId, "cart_customer.addresses", array($shoppingCartId, $arrAddresses)); 218 | var_dump($resultCustomerAddresses); 219 | break; 220 | case 'cartcustomerset': // OK 221 | $shoppingCartId = $proxy->call($sessionId, 'cart.create', array('1')); 222 | $resultCustomerSet = $proxy->call($sessionId, 'cart_customer.set', array($shoppingCartId, $customerAsGuest)); 223 | var_dump($resultCustomerSet); 224 | break; 225 | case 'cartlicense': // OK 226 | $shoppingCartId = $proxy->call($sessionId, 'cart.create', array('1')); 227 | $shoppingCartLicenses = $proxy->call($sessionId, "cart.license", array($shoppingCartId)); 228 | var_dump($shoppingCartLicenses); 229 | break; 230 | case 'cartinfo': //OK 231 | $shoppingCartId = $proxy->call($sessionId, 'cart.create', array('1')); 232 | $shoppingCartInfo = $proxy->call($sessionId, 'cart.info', array($shoppingCartId)); 233 | var_dump($shoppingCartInfo); 234 | break; 235 | case 'customerinfo': // OK 236 | $customerInfo = $proxy->call($sessionId, 'customer.info', array('19940')); 237 | var_dump($customerInfo); 238 | break; 239 | case 'customeraddresslist': // OK 240 | $customerInfo = $proxy->call($sessionId, 'customer_address.list', array('19940')); 241 | var_dump($customerInfo); 242 | break; 243 | case 'customeraddresscreate': // OK 244 | $rand = rand(1, 10000); 245 | $customerId = $proxy->call($sessionId, 'customer.create', array(array( 246 | 'email' => "customer-mail$rand@example.org", 247 | 'firstname' => "Dough$rand", 248 | 'lastname' => "Deeks$rand", 249 | 'password' => "password$rand", 250 | 'website_id' => 1, 251 | 'store_id' => 1, 252 | 'group_id' => 1))); 253 | $customerAddressResult = $proxy->call($sessionId, 'customer_address.create', array('19940', array('firstname' => 'John', 'lastname' => 'Doe', 'street' => array('Street line 1', 'Streer line 2'), 'city' => 'Weaverville', 'country_id' => 'US', 'region' => 'Texas', 'region_id' => 3, 'postcode' => '96093', 'telephone' => '530-623-2513', 'is_default_billing' => FALSE, 'is_default_shipping' => FALSE))); 254 | var_dump($customerAddressResult); 255 | break; 256 | case 'customeraddressinfo': // OK 257 | $customerInfo = $proxy->call($sessionId, 'customer_address.info', array('200')); 258 | var_dump($customerInfo); 259 | break; 260 | case 'customeraddressupdate': // OK 261 | $customerAddressResult = $proxy->call($sessionId, 'customer_address.update', array('200', array('firstname' => 'John', 'lastname' => 'Doe', 'street' => array('Street line 1', 'Streer line 2'), 'city' => 'Weaverville', 'country_id' => 'US', 'region' => 'Texas', 'region_id' => 3, 'postcode' => '96093', 'telephone' => '530-623-2513', 'is_default_billing' => FALSE, 'is_default_shipping' => FALSE))); 262 | var_dump($customerAddressResult); 263 | break; 264 | case 'customeraddressdelete': // OK 265 | 266 | $rand = rand(1, 10000); 267 | $customerId = $proxy->call($sessionId, 'customer.create', array(array( 268 | 'email' => "customer-mail$rand@example.org", 269 | 'firstname' => "Dough$rand", 270 | 'lastname' => "Deeks$rand", 271 | 'password' => "password$rand", 272 | 'website_id' => 1, 273 | 'store_id' => 1, 274 | 'group_id' => 1))); 275 | $customerAddressID = $proxy->call($sessionId, 'customer_address.create', array('19940', array('firstname' => 'John', 'lastname' => 'Doe', 'street' => array('Street line 1', 'Streer line 2'), 'city' => 'Weaverville', 'country_id' => 'US', 'region' => 'Texas', 'region_id' => 3, 'postcode' => '96093', 'telephone' => '530-623-2513', 'is_default_billing' => FALSE, 'is_default_shipping' => FALSE))); 276 | var_dump($customerAddressID); 277 | $customerAddressResult = $proxy->call($sessionId, 'customer_address.delete', $customerAddressID); 278 | var_dump($customerAddressResult); 279 | break; 280 | case 'customerupdate': // OK 281 | $rand = rand(1, 10000); 282 | $customerId = $proxy->call($sessionId, 'customer.update', array('customerId' => '20305', 'customerData' => array( 283 | 'email' => "customer-mail$rand@example.org", 284 | 'firstname' => "Dough$rand", 285 | 'lastname' => "Deeks$rand", 286 | 'password' => "password$rand", 287 | 'website_id' => 1, 288 | 'store_id' => 1, 289 | 'group_id' => 1))); 290 | var_dump($customerId); 291 | break; 292 | case 'customerlist': // OK 293 | $complexFilter = array('filter' => array( 294 | 'store_id' => 1, 295 | 'website_id' => 1, 296 | 'email' => "b42c081a99b0c3e9b3e4d6cf6b83ccf8@example.com" 297 | )); 298 | $customerList = $proxy->call($sessionId, 'customer.list', $complexFilter); 299 | var_dump($customerList); 300 | break; 301 | case 'customercreate': // OK 302 | $rand = rand(1, 10000); 303 | $customerId = $proxy->call($sessionId, 'customer.create', array(array( 304 | 'email' => "customer-mail$rand@example.org", 305 | 'firstname' => "Dough$rand", 306 | 'lastname' => "Deeks$rand", 307 | 'password' => "password$rand", 308 | 'website_id' => 1, 309 | 'store_id' => 1, 310 | 'group_id' => 1), 'source' => 'gino')); 311 | var_dump($customerId); 312 | break; 313 | case 'customerdelete': // OK 314 | $rand = rand(1, 10000); 315 | $customerId = $proxy->call($sessionId, 'customer.create', array(array( 316 | 'email' => "customer-maildel$rand@example.org", 317 | 'firstname' => "Dough$rand", 318 | 'lastname' => "Deeks$rand", 319 | 'password' => "password$rand", 320 | 'website_id' => 1, 321 | 'store_id' => 1, 322 | 'group_id' => 1))); 323 | $deleteResult = $proxy->call($sessionId, 'customer.delete', $customerId); 324 | var_dump($deleteResult); 325 | break; 326 | case 'cartproductadd': // OK 327 | $shoppingCartId = $proxy->call($sessionId, 'cart.create', array('1')); 328 | $arrProducts = array( 329 | array( 330 | "product_id" => $productId, 331 | "qty" => 1 332 | ) 333 | ); 334 | $resultCartProductAdd = $proxy->call($sessionId, "cart_product.add", array($shoppingCartId, $arrProducts)); 335 | var_dump($resultCartProductAdd); 336 | break; 337 | case 'cartproductupdate': // OK 338 | $shoppingCartId = $proxy->call($sessionId, 'cart.create', array('1')); 339 | $arrProducts = array( 340 | array( 341 | "product_id" => $productId, 342 | "qty" => 1 343 | ) 344 | ); 345 | $proxy->call($sessionId, "cart_product.add", array($shoppingCartId, $arrProducts)); 346 | $arrProductsUp = array( 347 | array( 348 | "product_id" => $productId, 349 | "qty" => 3 350 | ), 351 | ); 352 | $resultCartProductUpdate = $proxy->call($sessionId, "cart_product.update", array($shoppingCartId, $arrProductsUp)); 353 | var_dump($resultCartProductUpdate); 354 | break; 355 | case 'cartproductlist': // OK 356 | $shoppingCartId = $proxy->call($sessionId, 'cart.create', array('1')); 357 | $arrProducts = array( 358 | array( 359 | "product_id" => $productId, 360 | "qty" => 1 361 | ) 362 | ); 363 | $proxy->call($sessionId, "cart_product.add", array($shoppingCartId, $arrProducts)); 364 | $resultCartProductList = $proxy->call($sessionId, "cart_product.list", array($shoppingCartId)); 365 | var_dump($resultCartProductList); 366 | break; 367 | case 'cartproductremove': // OK 368 | $shoppingCartId = $proxy->call($sessionId, 'cart.create', array('1')); 369 | $arrProducts = array( 370 | array( 371 | "product_id" => $productId, 372 | "qty" => 1 373 | ) 374 | ); 375 | $proxy->call($sessionId, "cart_product.add", array($shoppingCartId, $arrProducts)); 376 | $resultCartProductRemove = $proxy->call($sessionId, "cart_product.remove", array($shoppingCartId, $arrProducts)); 377 | var_dump($resultCartProductRemove); 378 | break; 379 | case 'directorycountrylist': // OK 380 | $countryList = $proxy->call($sessionId, 'directory_country.list'); 381 | var_dump($countryList); 382 | break; 383 | case 'directoryregionlist': // OK 384 | $regionList = $proxy->call($sessionId, 'directory_region.list', array('ES')); 385 | var_dump($regionList); 386 | break; 387 | case 'salesorderlist': // OK 388 | $filter = array('filter' => array('increment_id' => '400006032')); 389 | $salesOrderList = $proxy->call($sessionId, 'order.list', $filter); 390 | var_dump($salesOrderList); 391 | break; 392 | case 'salesorderinfo': // OK 393 | $salesOrderList = $proxy->call($sessionId, 'order.info', '100007501'); 394 | var_dump($salesOrderList); 395 | break; 396 | case 'catalogproductattributemedialist': // OK 397 | $attributeMediaList = $proxy->call($sessionId, 'catalog_product_attribute_media.list', array('2699')); 398 | var_dump($attributeMediaList); 399 | break; 400 | case 'catalogproductattributeoptions': // OK 401 | $attributeOptions = $proxy->call($sessionId, 'catalog_product_attribute.options', array('size_so_uni')); 402 | var_dump($attributeOptions); 403 | break; 404 | case 'catalogproductlinklist': // OK 405 | $linkList = $proxy->call($sessionId, 'catalog_product_link.list', array('cross_sell', '7179')); 406 | var_dump($linkList); 407 | break; 408 | } 409 | -------------------------------------------------------------------------------- /shell/betterIndexer.php: -------------------------------------------------------------------------------- 1 | 24 | * @version 1 25 | */ 26 | require_once 'indexer.php'; 27 | ini_set('memory_limit', '1024M'); 28 | set_time_limit (1800); 29 | class Yameveo_Shell_Indexer extends Mage_Shell_Compiler 30 | { 31 | 32 | /** 33 | * Returns the actual microtime in seconds 34 | * @return float seconds 35 | */ 36 | protected function chrono() 37 | { 38 | list($msec, $sec) = explode(' ', microtime()); 39 | return ((float) $msec + (float) $sec); 40 | } 41 | 42 | /** 43 | * Run script 44 | * 45 | */ 46 | public function run() 47 | { 48 | if ($this->getArg('info')) { 49 | $processes = $this->_parseIndexerString('all'); 50 | foreach ($processes as $process) { 51 | /* @var $process Mage_Index_Model_Process */ 52 | echo sprintf('%-30s', $process->getIndexerCode()); 53 | echo $process->getIndexer()->getName() . PHP_EOL; 54 | } 55 | } 56 | elseif ($this->getArg('status') || $this->getArg('mode')) { 57 | if ($this->getArg('status')) { 58 | $processes = $this->_parseIndexerString($this->getArg('status')); 59 | } 60 | else { 61 | $processes = $this->_parseIndexerString($this->getArg('mode')); 62 | } 63 | foreach ($processes as $process) { 64 | /* @var $process Mage_Index_Model_Process */ 65 | $status = 'unknown'; 66 | if ($this->getArg('status')) { 67 | switch ($process->getStatus()) { 68 | case Mage_Index_Model_Process::STATUS_PENDING: 69 | $status = 'Pending'; 70 | break; 71 | case Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX: 72 | $status = 'Require Reindex'; 73 | break; 74 | case Mage_Index_Model_Process::STATUS_RUNNING: 75 | $status = 'Running'; 76 | break; 77 | default: 78 | $status = 'Ready'; 79 | break; 80 | } 81 | } 82 | else { 83 | switch ($process->getMode()) { 84 | case Mage_Index_Model_Process::MODE_REAL_TIME: 85 | $status = 'Update on Save'; 86 | break; 87 | case Mage_Index_Model_Process::MODE_MANUAL: 88 | $status = 'Manual Update'; 89 | break; 90 | } 91 | } 92 | echo sprintf('%-30s ', $process->getIndexer()->getName() . ':') . $status . PHP_EOL; 93 | } 94 | } 95 | elseif ($this->getArg('mode-realtime') || $this->getArg('mode-manual')) { 96 | if ($this->getArg('mode-realtime')) { 97 | $mode = Mage_Index_Model_Process::MODE_REAL_TIME; 98 | $processes = $this->_parseIndexerString($this->getArg('mode-realtime')); 99 | } 100 | else { 101 | $mode = Mage_Index_Model_Process::MODE_MANUAL; 102 | $processes = $this->_parseIndexerString($this->getArg('mode-manual')); 103 | } 104 | foreach ($processes as $process) { 105 | /* @var $process Mage_Index_Model_Process */ 106 | try { 107 | $process->setMode($mode)->save(); 108 | echo $process->getIndexer()->getName() . " index was successfully changed index mode" . PHP_EOL; 109 | } catch (Mage_Core_Exception $e) { 110 | echo $e->getMessage() . "\n"; 111 | } catch (Exception $e) { 112 | echo $process->getIndexer()->getName() . " index process unknown error:" . PHP_EOL; 113 | echo $e . "\n"; 114 | } 115 | } 116 | } 117 | elseif ($this->getArg('reindex') || $this->getArg('reindexall')) { 118 | if ($this->getArg('reindex')) { 119 | $processes = $this->_parseIndexerString($this->getArg('reindex')); 120 | } 121 | else { 122 | $processes = $this->_parseIndexerString('all'); 123 | } 124 | $totalstart = $this->chrono(); 125 | foreach ($processes as $process) { 126 | /* @var $process Mage_Index_Model_Process */ 127 | try { 128 | 129 | echo "Started " . $process->getIndexer()->getName() . " reindexing process" . PHP_EOL; 130 | $start = $this->chrono(); 131 | $process->reindexEverything(); 132 | $end = $this->chrono(); 133 | $chrono = round($end - $start, 3); 134 | echo $process->getIndexer()->getName() . " index was rebuilt successfully in $chrono seconds" . PHP_EOL; 135 | } catch (Mage_Core_Exception $e) { 136 | echo $e->getMessage() . "\n"; 137 | } catch (Exception $e) { 138 | echo $process->getIndexer()->getName() . " index process unknown error:" . PHP_EOL; 139 | echo $e . "\n"; 140 | } 141 | } 142 | $totalend = $this->chrono(); 143 | $totalchrono = round($totalend - $totalstart, 3); 144 | echo PHP_EOL; 145 | echo "All completed in $totalchrono seconds" . PHP_EOL; 146 | $mem = $this->_convertMemorySize(memory_get_usage()); 147 | $peak = $this->_convertMemorySize(memory_get_peak_usage()); 148 | echo "Used memory: $mem. Peak memory: $peak"; 149 | echo PHP_EOL; 150 | } 151 | else { 152 | echo $this->usageHelp(); 153 | } 154 | } 155 | 156 | private function _convertMemorySize($size) 157 | { 158 | $unit = array('B', 'KB', 'MB', 'GB', 'TB', 'PB'); 159 | return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2) . $unit[$i]; 160 | } 161 | } 162 | 163 | $shell = new Yameveo_Shell_Indexer(); 164 | $shell->run(); 165 | -------------------------------------------------------------------------------- /shell/changeOrderStatus.php: -------------------------------------------------------------------------------- 1 | 21 | * @version 1 22 | */ 23 | error_reporting(E_ALL); 24 | ini_set('display_errors', 1); 25 | require_once('../app/Mage.php'); 26 | Mage::app('admin'); 27 | $dateTo = '16 June 2012'; 28 | $orders = Mage::getModel('sales/order') 29 | ->getCollection() 30 | ->addAttributeToFilter('created_at', array('to' => $dateTo, 'date' => true)) 31 | ->addAttributeToFilter('status', 'shipped'); 32 | foreach($orders as $order) { 33 | $order->setStateUnprotected('complete')->setStatus('complete')->save(); 34 | } -------------------------------------------------------------------------------- /shell/cleanCache.php: -------------------------------------------------------------------------------- 1 | 23 | * @version 1 24 | */ 25 | 26 | require_once 'abstract.php'; 27 | 28 | class Yameveo_Shell_CleanCache extends Mage_Shell_Abstract 29 | { 30 | 31 | /** 32 | * Cleans image cache using catalog/product_image model. 33 | * 34 | */ 35 | protected function cleanImageCache() 36 | { 37 | try { 38 | echo "Cleaning image cache... "; 39 | flush(); 40 | echo Mage::getModel('catalog/product_image')->clearCache(); 41 | echo "[OK]" . PHP_EOL . PHP_EOL; 42 | } catch (Exception $e) { 43 | die("[ERROR:" . $e->getMessage() . "]" . PHP_EOL); 44 | } 45 | } 46 | 47 | /** 48 | * Cleans magento data cache: 49 | * - config, 50 | * - layout, 51 | * - block_html 52 | * - translate, 53 | * - collections, 54 | * - eav, 55 | * - config_api 56 | */ 57 | protected function cleanDataCache() 58 | { 59 | try { 60 | echo "Cleaning data cache:" . PHP_EOL; 61 | flush(); 62 | $types = Mage::app()->getCacheInstance()->getTypes(); 63 | foreach ($types as $type => $data) { 64 | echo "Removing $type ... "; 65 | echo Mage::app()->getCacheInstance()->clean($data["tags"]) ? "[OK]" : "[ERROR]"; 66 | echo PHP_EOL; 67 | } 68 | echo PHP_EOL; 69 | } catch (Exception $e) { 70 | die("[ERROR:" . $e->getMessage() . "]" . PHP_EOL); 71 | } 72 | } 73 | 74 | protected function cleanMergedJSCSS() 75 | { 76 | try { 77 | echo "Cleaning merged JS/CSS... "; 78 | flush(); 79 | Mage::getModel('core/design_package')->cleanMergedJsCss(); 80 | Mage::dispatchEvent('clean_media_cache_after'); 81 | echo "[OK]" . PHP_EOL . PHP_EOL; 82 | } catch (Exception $e) { 83 | die("[ERROR:" . $e->getMessage() . "]" . PHP_EOL); 84 | } 85 | } 86 | 87 | protected function cleanStoredCache() 88 | { 89 | try { 90 | echo "Cleaning stored cache... "; 91 | flush(); 92 | echo Mage::app()->getCacheInstance()->clean() ? "[OK]" : "[ERROR]"; 93 | echo PHP_EOL . PHP_EOL; 94 | } catch (Exception $e) { 95 | die("[ERROR:" . $e->getMessage() . "]" . PHP_EOL); 96 | } 97 | } 98 | 99 | /** 100 | * Does a rmdir on: 101 | * - cache, 102 | * - var/full_page_cache 103 | * - var/minifycache 104 | * - session dir 105 | * 106 | * @todo verify these functions 107 | * @todo check var dir for any other cleanable subdirs. 108 | */ 109 | protected function cleanFiles() 110 | { 111 | try { 112 | echo "Cleaning files:" . PHP_EOL; 113 | flush(); 114 | echo "Cache... "; 115 | $this->_rrmdirContent(Mage::getBaseDir('cache')); 116 | echo "[OK]" . PHP_EOL; 117 | $full_page_dir = Mage::getBaseDir('var') . DIRECTORY_SEPARATOR . 'full_page_cache'; 118 | if(is_dir($full_page_dir)) { 119 | echo "Full page cache... "; 120 | $this->_rrmdirContent($full_page_dir); 121 | echo "[OK]" . PHP_EOL; 122 | } 123 | $minify_dir = Mage::getBaseDir('var') . DIRECTORY_SEPARATOR . 'minifycache'; 124 | if(is_dir($minify_dir)) { 125 | echo "Minify cache... "; 126 | $this->_rrmdirContent($minify_dir); 127 | echo "[OK]" . PHP_EOL; 128 | } 129 | echo "Session... "; 130 | $this->_rrmdirContent(Mage::getBaseDir('session')); 131 | echo "[OK]" . PHP_EOL; 132 | echo PHP_EOL; 133 | } catch (Exception $e) { 134 | die("[ERROR:" . $e->getMessage() . "]" . PHP_EOL); 135 | } 136 | } 137 | 138 | protected function cleanAccelerator() 139 | { 140 | try { 141 | echo "Cleaning accelerator... "; 142 | flush(); 143 | accelerator_reset(); 144 | echo "[OK]" . PHP_EOL . PHP_EOL; 145 | } catch (Exception $e) { 146 | die("[ERROR:" . $e->getMessage() . "]" . PHP_EOL); 147 | } 148 | } 149 | 150 | protected function cleanAll() 151 | { 152 | $this->cleanImageCache(); 153 | $this->cleanDataCache(); 154 | $this->cleanStoredCache(); 155 | $this->cleanMergedJSCSS(); 156 | $this->cleanFiles(); 157 | if (function_exists('accelerator_reset')) { 158 | $this->cleanAccelerator(); 159 | } 160 | } 161 | 162 | /** 163 | * Run script 164 | * 165 | */ 166 | public function run() 167 | { 168 | ini_set("display_errors", 1); 169 | Mage::app('admin')->setUseSessionInUrl(false); 170 | Mage::getConfig()->init(); 171 | $caches = array('image', 'data', 'stored', 'js_css', 'files'); 172 | if ($this->getArg('info')) { 173 | echo 'Allowed caches: ' . PHP_EOL; 174 | foreach ($caches as $cache) { 175 | echo "\t" . $cache . PHP_EOL; 176 | } 177 | die(); 178 | } 179 | 180 | if ($this->getArg('all')) { 181 | $this->cleanAll(); 182 | die(); 183 | } 184 | 185 | if ($this->getArg('clean') && in_array($this->getArg('clean'), $caches)) { 186 | switch ($this->getArg('clean')) { 187 | case 'image': 188 | $this->cleanImageCache(); 189 | break; 190 | case 'data': 191 | $this->cleanDataCache(); 192 | break; 193 | case 'stored': 194 | $this->cleanStoredCache(); 195 | break; 196 | case 'js_css': 197 | $this->cleanMergedJSCSS(); 198 | break; 199 | case 'files': 200 | $this->cleanFiles(); 201 | break; 202 | } 203 | } else { 204 | echo $this->usageHelp(); 205 | } 206 | } 207 | 208 | /** 209 | * Removes all elements contained in the given directory 210 | * @param string $dir directory containing elements to remove 211 | */ 212 | private function _rrmdirContent($dir) 213 | { 214 | $items = array_diff(scandir($dir), array('..', '.')); 215 | foreach ($items as $item) { 216 | $path = $dir . DIRECTORY_SEPARATOR . $item; 217 | is_dir($path) ? $this->_rrmdir($path) : unlink($path); 218 | } 219 | } 220 | 221 | /** 222 | * Removes a directory and all elements contained 223 | * @param string $dir directory to remove 224 | */ 225 | private function _rrmdir($dir) 226 | { 227 | if (is_dir($dir)) { 228 | $objects = array_diff(scandir($dir), array('..', '.')); 229 | foreach ($objects as $object) { 230 | $path = $dir . DIRECTORY_SEPARATOR . $object; 231 | is_dir($path) ? $this->_rrmdir($path) : unlink($path); 232 | } 233 | reset($objects); 234 | rmdir($dir); 235 | } 236 | } 237 | 238 | /** 239 | * Retrieve Usage Help Message 240 | * 241 | */ 242 | public function usageHelp() 243 | { 244 | return << Clean . Any of [image|data|stored|js_css|files] 248 | all Clean all caches 249 | info Show allowed caches 250 | help This help 251 | 252 | 253 | USAGE; 254 | } 255 | 256 | } 257 | 258 | $shell = new Yameveo_Shell_CleanCache(); 259 | $shell->run(); 260 | -------------------------------------------------------------------------------- /shell/magentoCleanup.php: -------------------------------------------------------------------------------- 1 | 23 | * @version 1 24 | */ 25 | 26 | require_once 'cleanCache.php'; 27 | 28 | class Yameveo_Shell_Cleanup extends Yameveo_Shell_CleanCache 29 | { 30 | /** 31 | * Function to set file permissions to 0644 and folder permissions to 0755 32 | * @param string $dir 33 | * @param string $dirModes 34 | * @param string $fileModes 35 | */ 36 | private function fixPermissions($dir, $dirModes = 0755, $fileModes = 0644, $shModes = 0775) 37 | { 38 | echo "Setting all folder permissions to 755" . PHP_EOL; 39 | echo "Setting all file permissions to 644" . PHP_EOL; 40 | echo "Setting all sh scripts permissions to 775" . PHP_EOL; 41 | $d = new RecursiveDirectoryIterator($dir); 42 | foreach (new RecursiveIteratorIterator($d, 1) as $path) { 43 | if ($path->isDir()) // directory 44 | chmod($path, $dirModes); 45 | elseif (is_file($path) && strpos($path, '.sh')) // sh scripts 46 | chmod($path, $shModes); 47 | elseif (is_file($path)) // files 48 | chmod($path, $fileModes); 49 | } 50 | } 51 | 52 | /** 53 | * Run script 54 | * 55 | */ 56 | public function run() 57 | { 58 | $baseDir = Mage::getBaseDir(); 59 | $this->fixPermissions($baseDir); 60 | echo "Setting 'mage' permissions to 550" . PHP_EOL; 61 | chmod($baseDir . DIRECTORY_SEPARATOR . "mage", 0550); 62 | echo "Setting 'lib/PEAR' permissions to 550" . PHP_EOL; 63 | chmod($baseDir . DIRECTORY_SEPARATOR . "lib" . DIRECTORY_SEPARATOR . "PEAR", 0550); 64 | $this->cleanFiles(); 65 | } 66 | 67 | } 68 | 69 | $shell = new Yameveo_Shell_Cleanup(); 70 | $shell->run(); -------------------------------------------------------------------------------- /shell/testObserver.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | 25 | require_once 'abstract.php'; 26 | 27 | class Yameveo_Shell_Example extends Mage_Shell_Abstract 28 | { 29 | 30 | /** 31 | * Example observer object 32 | * 33 | * @var Yameveo_Example_Model_Observer 34 | */ 35 | protected $_example; 36 | 37 | /** 38 | * Get example observer object 39 | * 40 | * @return Yameveo_Example_Model_Observer 41 | */ 42 | protected function _getExample() 43 | { 44 | if ($this->_example === null) { 45 | $this->_example = new Yameveo_Example_Model_Observer(); 46 | } 47 | return $this->_example; 48 | } 49 | 50 | /** 51 | * Run script 52 | * 53 | */ 54 | public function run() 55 | { 56 | $functions = array('method_1', 'method_2', 'method_3', 'method_4', 'method_5'); 57 | if ($this->getArg('info')) { 58 | foreach ($functions as $function) { 59 | echo $function . PHP_EOL; 60 | } 61 | } 62 | elseif ($this->getArg('execute') && in_array($this->getArg('execute'), 63 | $functions)) { 64 | return $this->_getExample()->{$this->getArg('execute')}(); 65 | } 66 | else { 67 | echo $this->usageHelp(); 68 | } 69 | } 70 | 71 | /** 72 | * Retrieve Usage Help Message 73 | * 74 | */ 75 | public function usageHelp() 76 | { 77 | return << Execute given action 81 | info Show allowed functions 82 | help This help 83 | 84 | php function name 85 | 86 | USAGE; 87 | } 88 | 89 | } 90 | 91 | $shell = new Yameveo_Shell_Example(); 92 | $shell->run(); 93 | -------------------------------------------------------------------------------- /sql/clean_db.sql: -------------------------------------------------------------------------------- 1 | # Clean the database 2 | # @author Andrea De Pirro 3 | SET FOREIGN_KEY_CHECKS=0; 4 | TRUNCATE `adminnotification_inbox`; 5 | TRUNCATE `catalog_category_product`; 6 | TRUNCATE `catalog_category_product_index`; 7 | TRUNCATE `catalog_product_entity`; 8 | TRUNCATE `catalog_product_entity_datetime`; 9 | TRUNCATE `catalog_product_entity_decimal`; 10 | TRUNCATE `catalog_product_entity_gallery`; 11 | TRUNCATE `catalog_product_entity_int`; 12 | TRUNCATE `catalog_product_entity_media_gallery`; 13 | TRUNCATE `catalog_product_entity_media_gallery_value`; 14 | TRUNCATE `catalog_product_entity_text`; 15 | TRUNCATE `catalog_product_entity_varchar`; 16 | TRUNCATE `catalog_product_flat_1`; 17 | TRUNCATE `catalog_product_index_eav`; 18 | TRUNCATE `catalog_product_index_eav_idx`; 19 | TRUNCATE `catalog_product_index_eav_tmp`; 20 | TRUNCATE `catalog_product_index_price`; 21 | TRUNCATE `catalog_product_index_price_idx`; 22 | TRUNCATE `catalog_product_index_website`; 23 | TRUNCATE `catalog_product_website`; 24 | TRUNCATE `core_url_rewrite`; 25 | TRUNCATE `cron_schedule`; 26 | TRUNCATE `customer_address_entity`; 27 | TRUNCATE `customer_address_entity_int`; 28 | TRUNCATE `customer_address_entity_text`; 29 | TRUNCATE `customer_address_entity_varchar`; 30 | TRUNCATE `customer_entity`; 31 | TRUNCATE `customer_entity_int`; 32 | TRUNCATE `customer_entity_text`; 33 | TRUNCATE `customer_entity_varchar`; 34 | TRUNCATE `index_event`; 35 | TRUNCATE `index_process_event`; 36 | TRUNCATE `log_customer`; 37 | TRUNCATE `log_quote`; 38 | TRUNCATE `log_url`; 39 | TRUNCATE `log_url_info`; 40 | TRUNCATE `log_visitor`; 41 | TRUNCATE `log_visitor_info`; 42 | TRUNCATE `log_visitor_online`; 43 | TRUNCATE `newsletter_queue`; 44 | TRUNCATE `newsletter_queue_link`; 45 | TRUNCATE `newsletter_queue_store_link`; 46 | TRUNCATE `newsletter_subscriber`; 47 | TRUNCATE `poll`; 48 | TRUNCATE `poll_answer`; 49 | TRUNCATE `poll_store`; 50 | TRUNCATE `report_compared_product_index`; 51 | TRUNCATE `report_event`; 52 | TRUNCATE `report_viewed_product_index`; 53 | TRUNCATE `sales_flat_invoice`; 54 | TRUNCATE `sales_flat_invoice_comment`; 55 | TRUNCATE `sales_flat_invoice_grid`; 56 | TRUNCATE `sales_flat_invoice_item`; 57 | TRUNCATE `sales_flat_order`; 58 | TRUNCATE `sales_flat_order_address`; 59 | TRUNCATE `sales_flat_order_grid`; 60 | TRUNCATE `sales_flat_order_item`; 61 | TRUNCATE `sales_flat_order_payment`; 62 | TRUNCATE `sales_flat_order_status_history`; 63 | TRUNCATE `sales_flat_quote`; 64 | TRUNCATE `sales_flat_quote_address`; 65 | TRUNCATE `sales_flat_quote_address_item`; 66 | TRUNCATE `sales_flat_quote_item`; 67 | TRUNCATE `sales_flat_quote_item_option`; 68 | TRUNCATE `sales_flat_quote_payment`; 69 | TRUNCATE `sales_order_tax`; 70 | TRUNCATE `sales_payment_transaction`; 71 | TRUNCATE `wishlist`; 72 | SET FOREIGN_KEY_CHECKS=1; 73 | -------------------------------------------------------------------------------- /sql/createProductsProcedure.sql: -------------------------------------------------------------------------------- 1 | # @author ryaan-anthony 2 | # https://gist.github.com/ryaan-anthony/6290973 3 | # Usage: 4 | # For 9 categories and 99.999 products, run the code: 5 | # mysql > call build_catalog(10,100000); 6 | 7 | delimiter ;; 8 | drop procedure if exists build_catalog;; 9 | create procedure build_catalog(IN categories INT, IN products INT) 10 | begin 11 | SET @category_count = 1; 12 | SET @CATNAMEPREFIX = "Category "; 13 | SET @CATURLKEYPREFIX = "cat-"; 14 | SET @CATURLPATHPREFIX = "catpath-"; 15 | SET @ROOTCATEGORY = 2; 16 | SET @INCLUDEINMENU = 1; 17 | SET @ISACTIVE = 1; 18 | SELECT @category_entity_type_id := entity_type_id from eav_entity_type where entity_type_code = 'catalog_category'; 19 | SELECT @category_attribute_set_id := attribute_set_id from eav_attribute_set where attribute_set_name = 'Default' and entity_type_id = @category_entity_type_id; 20 | SELECT @include_in_menu := attribute_id from eav_attribute where attribute_code = 'include_in_menu' and entity_type_id = @category_entity_type_id; 21 | SELECT @is_active := attribute_id from eav_attribute where attribute_code = 'is_active' and entity_type_id = @category_entity_type_id; 22 | SELECT @category_name_id := attribute_id from eav_attribute where attribute_code = 'name' and entity_type_id = @category_entity_type_id; 23 | SELECT @category_url_key_id := attribute_id from eav_attribute where attribute_code = 'url_key' and entity_type_id = @category_entity_type_id; 24 | SELECT @category_url_path_id := attribute_id from eav_attribute where attribute_code = 'url_path' and entity_type_id = @category_entity_type_id; 25 | WHILE @category_count < categories DO 26 | SELECT @category_entity_id := AUTO_INCREMENT from information_schema.tables where table_name = 'catalog_category_entity'; 27 | INSERT INTO catalog_category_entity (entity_type_id,attribute_set_id,parent_id,created_at,updated_at,path,position,level,children_count) VALUES (@category_entity_type_id,@category_attribute_set_id,@ROOTCATEGORY,NOW(),NOW(),concat("1/2/", @category_entity_id),1,2,0); 28 | INSERT INTO catalog_category_entity_int (entity_type_id,attribute_id,entity_id,value) VALUES(@category_entity_type_id,@include_in_menu,@category_entity_id,@INCLUDEINMENU); 29 | INSERT INTO catalog_category_entity_int (entity_type_id,attribute_id,entity_id,value) VALUES(@category_entity_type_id,@is_active,@category_entity_id,@ISACTIVE); 30 | INSERT INTO catalog_category_entity_varchar (entity_type_id,attribute_id,entity_id,value) VALUES(@category_entity_type_id,@category_url_key_id,@category_entity_id,concat(@CATURLKEYPREFIX, @category_count)); 31 | INSERT INTO catalog_category_entity_varchar (entity_type_id,attribute_id,entity_id,value) VALUES(@category_entity_type_id,@category_url_path_id,@category_entity_id,concat(@CATURLPATHPREFIX, @category_count)); 32 | INSERT INTO catalog_category_entity_varchar (entity_type_id,attribute_id,entity_id,value) VALUES(@category_entity_type_id,@category_name_id,@category_entity_id,concat(@CATNAMEPREFIX, @category_count)); 33 | SET @category_count = @category_count + 1; 34 | END WHILE; 35 | 36 | SET @product_count = 1; 37 | SET @NAMEPREFIX = "Test Product "; 38 | SET @URLKEYPREFIX = "key-"; 39 | SET @URLPATHPREFIX = "path-"; 40 | SET @SKUPREFIX = "sku-"; 41 | SET @VISIBILITY = 4; 42 | SET @STATUS = 1; 43 | SET @TAXCLASS = 2; 44 | SET @MAXPRICE = 100; 45 | SET @MAXWEIGHT = 20; 46 | SET @WEBSITE = 1; 47 | SET @STOREID = 1; 48 | SET @QTY = 999; 49 | SET @DESCRIPTION = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; 50 | SET @SHORTDESCRIPTION = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."; 51 | SELECT @entity_type_id := entity_type_id from eav_entity_type where entity_type_code = 'catalog_product'; 52 | SELECT @attribute_set_id := attribute_set_id from eav_attribute_set where attribute_set_name = 'Default' and entity_type_id = @entity_type_id; 53 | SELECT @visibility_id := attribute_id from eav_attribute where attribute_code = 'visibility' and entity_type_id = @entity_type_id; 54 | SELECT @status_id := attribute_id from eav_attribute where attribute_code = 'status' and entity_type_id = @entity_type_id; 55 | SELECT @taxclass_id := attribute_id from eav_attribute where attribute_code = 'tax_class_id' and entity_type_id = @entity_type_id; 56 | SELECT @description_id := attribute_id from eav_attribute where attribute_code = 'description' and entity_type_id = @entity_type_id; 57 | SELECT @short_description_id := attribute_id from eav_attribute where attribute_code = 'short_description' and entity_type_id = @entity_type_id; 58 | SELECT @price_id := attribute_id from eav_attribute where attribute_code = 'price' and entity_type_id = @entity_type_id; 59 | SELECT @weight_id := attribute_id from eav_attribute where attribute_code = 'weight' and entity_type_id = @entity_type_id; 60 | SELECT @name_id := attribute_id from eav_attribute where attribute_code = 'name' and entity_type_id = @entity_type_id; 61 | SELECT @url_key_id := attribute_id from eav_attribute where attribute_code = 'url_key' and entity_type_id = @entity_type_id; 62 | SELECT @url_path_id := attribute_id from eav_attribute where attribute_code = 'url_path' and entity_type_id = @entity_type_id; 63 | 64 | WHILE @product_count < products DO 65 | INSERT INTO catalog_product_entity (entity_type_id,attribute_set_id,type_id,sku,created_at,updated_at) VALUES (@entity_type_id,@attribute_set_id,"simple",concat(@SKUPREFIX, @product_count),NOW(),NOW()); 66 | SELECT @entity_id := entity_id from catalog_product_entity order by entity_id desc limit 1; 67 | INSERT INTO catalog_product_entity_int (entity_type_id,attribute_id,entity_id,value) VALUES(@entity_type_id,@visibility_id,@entity_id,@VISIBILITY); 68 | INSERT INTO catalog_product_entity_int (entity_type_id,attribute_id,entity_id,value) VALUES(@entity_type_id,@status_id,@entity_id,@STATUS); 69 | INSERT INTO catalog_product_entity_int (entity_type_id,attribute_id,entity_id,value) VALUES(@entity_type_id,@taxclass_id,@entity_id,@TAXCLASS); 70 | INSERT INTO catalog_product_entity_text (entity_type_id,attribute_id,entity_id,value) VALUES(@entity_type_id,@description_id,@entity_id,@DESCRIPTION); 71 | INSERT INTO catalog_product_entity_text (entity_type_id,attribute_id,entity_id,value) VALUES(@entity_type_id,@short_description_id,@entity_id,@SHORTDESCRIPTION); 72 | INSERT INTO catalog_product_entity_decimal (entity_type_id,attribute_id,entity_id,value) VALUES(@entity_type_id,@price_id,@entity_id,ROUND(RAND() * @MAXPRICE,2)); 73 | INSERT INTO catalog_product_entity_decimal (entity_type_id,attribute_id,entity_id,value) VALUES(@entity_type_id,@weight_id,@entity_id,ROUND(RAND() * @MAXWEIGHT,2)); 74 | INSERT INTO catalog_product_entity_varchar (entity_type_id,attribute_id,entity_id,value) VALUES(@entity_type_id,@url_key_id,@entity_id,concat(@URLKEYPREFIX, @product_count)); 75 | INSERT INTO catalog_product_entity_varchar (entity_type_id,attribute_id,store_id,entity_id,value) VALUES(@entity_type_id,@url_path_id,@STOREID,@entity_id,concat(@URLPATHPREFIX, @product_count)); 76 | INSERT INTO catalog_product_entity_varchar (entity_type_id,attribute_id,entity_id,value) VALUES(@entity_type_id,@url_path_id,@entity_id,concat(@URLPATHPREFIX, @product_count)); 77 | INSERT INTO catalog_product_entity_varchar (entity_type_id,attribute_id,entity_id,value) VALUES(@entity_type_id,@name_id,@entity_id,concat(@NAMEPREFIX, @product_count)); 78 | INSERT INTO catalog_category_product (category_id,product_id,position) VALUES((SELECT entity_id FROM catalog_category_entity WHERE parent_id = @ROOTCATEGORY ORDER BY RAND() LIMIT 1),@entity_id,1); 79 | SELECT @last_id := category_id from catalog_category_product order by product_id desc limit 1; 80 | INSERT INTO catalog_category_product_index (category_id,product_id,position,is_parent,visibility) VALUES(@last_id,@entity_id,1,1,4); 81 | INSERT INTO cataloginventory_stock_item (product_id,stock_id,qty,is_in_stock) VALUES (@entity_id,1,@QTY,1); 82 | INSERT INTO cataloginventory_stock_status (product_id,website_id,stock_id,qty,stock_status) VALUES (@entity_id,@WEBSITE,1,@QTY,1); 83 | INSERT INTO catalog_product_website (product_id,website_id) VALUES (@entity_id,@WEBSITE); 84 | SET @product_count = @product_count + 1; 85 | END WHILE; 86 | end 87 | ;; 88 | -------------------------------------------------------------------------------- /sql/create_admin_community1.5+.sql: -------------------------------------------------------------------------------- 1 | # @author David G Vigil 2 | # This is for Community version 1.5+ 3 | # for older versions remove both rp_token lines in admin_user 4 | # password is: MagnetoCheat 5 | 6 | INSERT INTO admin_user 7 | SELECT 8 | (SELECT max(user_id) + 1 FROM admin_user) user_id, 9 | 'Bob' first_name, 10 | 'Saget' last_name, 11 | 'bob@bobsagetisgod.com' email, 12 | 'bobsaget' username, 13 | '7cc7c895dee1d6b4c068d8ed986f5908:mk' password, 14 | now() created, 15 | NULL modified, 16 | NULL logdate, 17 | 0 lognum, 18 | 0 reload_acl_flag, 19 | 1 is_active, 20 | (SELECT max(extra) FROM admin_user WHERE extra is not null) extra, 21 | NULL rp_token, 22 | NOW() rp_token_created_at; 23 | 24 | INSERT INTO admin_role 25 | SELECT 26 | (SELECT max(role_id) + 1 FROM admin_role) role_id, 27 | (SELECT role_id FROM admin_role WHERE role_name = 'Administrators') parent_id, 28 | 2 tree_level, 29 | 0 sort_order, 30 | 'U' role_type, 31 | (SELECT user_id FROM admin_user WHERE username = 'zladmin') user_id, 32 | 'bobsaget' role_name; 33 | -------------------------------------------------------------------------------- /sql/create_admin_enterprise1.1+.sql: -------------------------------------------------------------------------------- 1 | # @author David G Vigil 2 | # This is for Enterprise version 1.10+ 3 | # password is: MagnetoCheat 4 | 5 | INSERT INTO admin_user 6 | SELECT 7 | (SELECT max(user_id) + 1 FROM admin_user) user_id, 8 | 'Bob' first_name, 9 | 'Saget' last_name, 10 | 'bob@bobsagetisgod.com' email, 11 | 'bobsaget' username, 12 | '7cc7c895dee1d6b4c068d8ed986f5908:mk' password, 13 | now() created, 14 | NULL modified, 15 | NULL logdate, 16 | 0 lognum, 17 | 0 reload_acl_flag, 18 | 1 is_active, 19 | (SELECT max(extra) FROM admin_user WHERE extra is not null) extra, 20 | NULL rp_token, 21 | NOW() rp_token_created_at 22 | NULL first_failure, 23 | NULL lock_expires; 24 | 25 | INSERT INTO admin_role 26 | SELECT 27 | (SELECT max(role_id) + 1 FROM admin_role) role_id, 28 | (SELECT role_id FROM admin_role WHERE role_name = 'Administrators') parent_id, 29 | 2 tree_level, 30 | 0 sort_order, 31 | 'U' role_type, 32 | (SELECT user_id FROM admin_user WHERE username = 'bobsaget') user_id, 33 | 'bobsaget' role_name 34 | 1 gws_is_all, 35 | NULL gws_websites, 36 | NULL gws_store_groups; 37 | -------------------------------------------------------------------------------- /sql/disableCategory.sql: -------------------------------------------------------------------------------- 1 | # @author Andrea De Pirro 2 | 3 | UPDATE 4 | catalog_category_entity_int 5 | SET 6 | value = 0 7 | WHERE 8 | attribute_id = (SELECT 9 | attribute_id 10 | FROM 11 | eav_attribute 12 | WHERE 13 | attribute_code = 'is_active') and entity_id = (SELECT DISTINCT 14 | entity_id 15 | FROM 16 | catalog_category_entity_varchar 17 | WHERE 18 | attribute_id = (SELECT 19 | attribute_id 20 | FROM 21 | eav_attribute 22 | WHERE 23 | attribute_code = 'url_key' AND entity_type_id = (SELECT * FROM eav_entity_type where entity_type_code = 'catalog_category')) AND value = 'urlkey'); -------------------------------------------------------------------------------- /sql/disableProducts.sql: -------------------------------------------------------------------------------- 1 | # @author Andrea De Pirro 2 | 3 | UPDATE catalog_product_entity_int 4 | SET value = '2' 5 | WHERE attribute_id = (SELECT attribute_id 6 | FROM eav_attribute 7 | WHERE attribute_code = 'status' 8 | AND entity_type_id = 4) 9 | AND entity_id IN ( 1, 2, 3 ); -------------------------------------------------------------------------------- /sql/getParents.sql: -------------------------------------------------------------------------------- 1 | # @author Andrea De Pirro 2 | 3 | SELECT DISTINCT 4 | parent_id 5 | FROM 6 | catalog_product_super_link 7 | WHERE 8 | product_id IN (1 , 2, 3); -------------------------------------------------------------------------------- /sql/localEnv.sql: -------------------------------------------------------------------------------- 1 | # @author Andrea De Pirro 2 | 3 | SET FOREIGN_KEY_CHECKS=0; 4 | UPDATE `core_config_data` SET `value` = "http://localhost/" WHERE `path` = "web/unsecure/base_url"; 5 | UPDATE `core_config_data` SET `value` = "http://localhost/" WHERE `path` = "web/secure/base_url"; 6 | UPDATE `core_config_data` SET `value` = "http://localhost/" WHERE `path` = "web/unsecure/base_web_url"; 7 | UPDATE `core_config_data` SET `value` = "http://localhost/" WHERE `path` = "web/secure/base_web_url"; 8 | UPDATE `core_config_data` SET `value` = "{{unsecure_base_url}}" WHERE `path` = "web/unsecure/base_link_url"; 9 | UPDATE `core_config_data` SET `value` = "{{unsecure_base_url}}/skin/" WHERE `path` = "web/unsecure/base_skin_url"; 10 | UPDATE `core_config_data` SET `value` = "{{unsecure_base_url}}/media/" WHERE `path` = "web/unsecure/base_media_url"; 11 | UPDATE `core_config_data` SET `value` = "{{unsecure_base_url}}/js/" WHERE `path` = "web/unsecure/base_js_url"; 12 | UPDATE `core_config_data` SET `value` = "{{secure_base_url}}" WHERE `path` = "web/secure/base_link_url"; 13 | UPDATE `core_config_data` SET `value` = "{{secure_base_url}}/skin/" WHERE `path` = "web/secure/base_skin_url"; 14 | UPDATE `core_config_data` SET `value` = "{{secure_base_url}}/media/" WHERE `path` = "web/secure/base_media_url"; 15 | UPDATE `core_config_data` SET `value` = "{{secure_base_url}}/js/" WHERE `path` = "web/secure/base_js_url"; 16 | UPDATE `core_config_data` SET `value` = "0" WHERE `path` = "web/secure/use_in_adminhtml"; 17 | UPDATE `core_config_data` SET `value` = "0" WHERE `path` = "web/secure/use_in_frontend"; 18 | UPDATE `core_cache_option` SET `value` = 0; 19 | UPDATE `core_config_data` SET `value` = "0" WHERE `path` = "dev/js/merge_files"; 20 | UPDATE `core_config_data` SET `value` = "0" WHERE `path` = "dev/css/merge_files"; 21 | UPDATE `core_store` SET store_id = 0 WHERE code='admin'; 22 | UPDATE `core_store_group` SET group_id = 0 WHERE name='Default'; 23 | UPDATE `core_website` SET website_id = 0 WHERE code='admin'; 24 | UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN'; 25 | TRUNCATE `log_customer`; 26 | TRUNCATE `log_quote`; 27 | TRUNCATE `log_summary`; 28 | TRUNCATE `log_summary_type`; 29 | TRUNCATE `log_url`; 30 | TRUNCATE `log_url_info`; 31 | TRUNCATE `log_visitor`; 32 | TRUNCATE `log_visitor_info`; 33 | TRUNCATE `log_visitor_online`; 34 | SET FOREIGN_KEY_CHECKS=1; -------------------------------------------------------------------------------- /sql/magento-1.9.1.0.mwb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akira28/magento-utils/d64312cc1b37d59d9667b4b52e5636df825cf630/sql/magento-1.9.1.0.mwb -------------------------------------------------------------------------------- /sql/obfuscateUsers.sql: -------------------------------------------------------------------------------- 1 | # @author Andrea De Pirro 2 | 3 | UPDATE `customer_entity` 4 | SET `email` = CONCAT (MD5(`email`), "@", "example.com"); 5 | 6 | UPDATE `sales_flat_order` 7 | SET `customer_email` = CONCAT (SUBSTR(MD5(`customer_email`), 6), "@", 8 | "example.com") 9 | , 10 | `customer_firstname` = MD5(`customer_firstname`), 11 | `customer_lastname` = MD5(`customer_lastname`); 12 | 13 | UPDATE `sales_flat_order_address` 14 | SET `email` = CONCAT (SUBSTR(MD5(`email`), 6), "@", "example.com"), 15 | `firstname` = MD5(`firstname`), 16 | `lastname` = MD5(`lastname`); 17 | 18 | UPDATE `sales_flat_quote` 19 | SET `customer_email` = CONCAT (SUBSTR(MD5(`customer_email`), 6), "@", 20 | "example.com") 21 | , 22 | `customer_firstname` = MD5(`customer_firstname`), 23 | `customer_lastname` = MD5(`customer_lastname`); 24 | 25 | UPDATE `sales_flat_quote_address` 26 | SET `email` = CONCAT (SUBSTR(MD5(`email`), 6), "@", "example.com"), 27 | `firstname` = MD5(`firstname`), 28 | `lastname` = MD5(`lastname`); 29 | --------------------------------------------------------------------------------